I would like to call statics methods in a helpers folders.
I have tried many tutos but it's always for just one file.
My config /app/Helpers/Languages.php -> my static class
composer.json
"autoload": {
"classmap": [
"database",
"app/Helpers/" <- I understand, L5 add in own autoload
app.php
'aliases' => [ ...., 'Languages' => 'App\Helpers\Languages',
What I tried :
- Add autoload classmap, HelpersServiceProviders class, namespace (work just in blade template, not in a Controller)
- Add autoload psr-4 with and without classmap, namespace
For all the method, I need to put the use 'app/Helpers/Languages' but I would like call just Languages::myFunction() without 'use' . Is it possible ?
I already the 'app/' folder in psr-4 so it will be load folder and my file, isn't it ?
If it's can help when in load a page without I've :
FatalErrorException Class 'App\Http\Controllers\Languages' not found
When I updated composer.json, I did't forgot composer dump-autoload
Languages.php
at the top placenamespace App\Helpers;
and at the top of your controlleruse App\Helpers\Languages;
. You'll need tocomposer dumpautoload
once. – user2094178