Welcome Guest, Not a member yet? Register   Sign In
[Solved] Autoloading core classes and composer
#4

Okies,

Seems I found the right answer here.  It's a little weird because I'm still not sure what the full behind the scenes are doing but here goes. Link at the bottom for a hard to find answer.

Place this code in application/config.php (I did it at the bottom)

PHP Code:
function __autoload($class)
{
 if(
strpos($class'CI_') !== 0)
 {
 
 @include_once( APPPATH 'core/'$class '.php' );
 }



Then in application/config.php change

PHP Code:
$config['composer_autoload'] =  false

to:

PHP Code:
$config['composer_autoload'] =  'vendor/autoload.php'// or wherever you've installed composer 


Then, in composer.json add:

PHP Code:
"autoload": {
 
         "classmap": ["application/core"]
     }, 


Lastly, in your terminal run:

PHP Code:
composer update 


Now I have access to Admin_controller when called and I have access to the Stripe (in my case) Object.



Reference:
https://expressionengine.com/forums/arch...odeigniter

Notes: This works in CI 3.1.3 and 3.1.6
Reply


Messages In This Thread
RE: Autoloading core classes and composer - by enlivenapp - 10-13-2017, 09:50 PM



Theme © iAndrew 2016 - Forum software by © MyBB