CodeIgniter Forums

Full Version: How to autoload shared package
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[eluser]noslen1[/eluser]
I'd like to use the Package feature for sharing libraries and helpers between applications.
My CodeIgniter structure looks like :
Code:
/back/ // admin app
    /config/
    /controllers/
    /helpers/
    ...
/front/ // main site app
    /config/
    /controllers/
    /helpers/
    ...
/shared/
    /helpers/
    /libraries/
    /models/
/system/
    /core/
    /database/
    ...
/www/
    /back/
        /css/
        ...
    /front/
        /css/
        ...
But when I move some code from /back/helpers and /back/libraries to /shared/helpers, and /shared/libraries, and load the "shared" package like this in /back/config/autoload.php:
Code:
$autoload['packages'] = array('/shared');
It just doesn't work.

I also tried others combinations, but nothing works
Code:
$autoload['packages'] = array('shared');
$autoload['packages'] = array('/shared/');
$autoload['packages'] = array('shared/');
$autoload['packages'] = array('./shared');
$autoload['packages'] = array('shared/helpers', 'shared/libraries');

What am I doing wrong or missing ?

El Forum

[eluser]noslen1[/eluser]
How could I achieve this please ? :-S

What did you do to have resources shared between applications ?

El Forum

[eluser]noslen1[/eluser]
In fact I think that only my extended helpers placed in my shared package folder seemed not to be loaded.
So I found this thread on the EllisLab github, opened 11 months ago, and fixed just few days ago in this commit Smile
Hope it will be part of the next CI update !