how i can create my library in codeigniter 4 |
this is easy in codeigniter 3 but i cant find this in codeigniter 4 document
I update the Google Recaptcha Class from version 3 to 4, here is an example
[Attachment = 1748] and in system/Controller.php in the initController function, I define it in a global variable for all controller's $this->g_re = new Recaptcha ($request, $response);
(04-02-2020, 01:03 PM)Hoodini Wrote: this is easy in codeigniter 3 but i cant find this in codeigniter 4 document It is even easier than V3. The only tricky bit is learning to use namespace. Here's a very simple library app/Libraries/MyCustomClass.php PHP Code: <?php namespace App\Libraries; Here's a simple example of using the custom library in a controller. PHP Code: <?php namespace App\Controllers;
If you need a single instance of a class, you can create a service that will return a shared instance of your library: https://codeigniter4.github.io/userguide...ed-classes
|
Welcome Guest, Not a member yet? Register Sign In |