Welcome Guest, Not a member yet? Register   Sign In
Adding additional "packages" to Autoload->psr4
#3

(This post was last modified: 07-29-2016, 02:06 PM by mixinix.)

This is my poor skill and trick... and works.

PHP Code:
$psr4 = [
    
APP_NAMESPACE                => APPPATH,
    
'Config'                     => APPPATH.'Config',
 
       // Base Class
 
       'App\Base'                   => APPPATH.'Base',
];
 
       
$psr4 
array_merge((array)(@include(WRITEPATH 'modules.php')), $psr4); 

In CodeIgniter4, many tricks and combinations I can do, everywhere and anywhere. Of course, with namespace.

../writable/modules.php

PHP Code:
<?php

return [
 
   'Module\Template\AdminLTE'   => APPPATH.'../modules/Templates/AdminLTE',
    'Module\Blog'                => APPPATH.'../modules/Blog',
    // Widgets
    'App\Widgets'                => APPPATH.'Widgets',
    // Third Parties
   'ThirdParty\Mixinix\Template'  => APPPATH 'ThirdParty/Mixinix/CodeIgniter4-template',
    // From Github libraries
   'Pug'  => GITHUB_PATH 'pug-php/pug/src/Pug',
   'Jade'  => GITHUB_PATH 'pug-php/pug/src/Jade',
]; 

That modules.php file can be created and modify form database.
Reply


Messages In This Thread
RE: Adding additional &quot;packages&quot; to Autoload-&gt;psr4 - by mixinix - 07-29-2016, 02:04 PM



Theme © iAndrew 2016 - Forum software by © MyBB