Welcome Guest, Not a member yet? Register   Sign In
How to create a library?
#5

(12-07-2019, 09:24 PM)ciadmin Wrote: Er, The above advice is more for CI3.

For CI4, create libraries as classes inside some app folder, eg app/Libraries, and make sure that they are properly namepaced.

Eg:
<?php namespace App\Libraries\MyStuff;
class MyStuff {
}


and then load/reference it with
$mystuff = new App\Libraries\MyStuff();

and away you go.

Sorry I do not understand. When trying the example, I get the following error: Class 'App\Controllers\App\Libraries\MyStuff' not found
What do I still have to do, to make it work correctly?
Reply


Messages In This Thread
How to create a library? - by MatheusCastro - 12-07-2019, 11:29 AM
RE: How to create a library? - by acewebcreations - 12-07-2019, 08:51 PM
RE: How to create a library? - by ciadmin - 12-07-2019, 09:24 PM
RE: How to create a library? - by MatheusCastro - 12-08-2019, 04:27 AM
RE: How to create a library? - by Martin_Salas - 12-15-2019, 06:40 AM
RE: How to create a library? - by InsiteFX - 12-15-2019, 09:33 AM
RE: How to create a library? - by Martin_Salas - 12-15-2019, 03:12 PM
RE: How to create a library? - by miqueiaspenha - 07-02-2020, 12:26 PM
RE: How to create a library? - by cvlancvlan - 06-30-2020, 09:38 AM



Theme © iAndrew 2016 - Forum software by © MyBB