• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Adding additional "packages" to Autoload->psr4

#3
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

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.