11. Create a helpers.php file in your app folder and load it up with composer:
2
3"autoload": {
4 "classmap": [
5 ...
6 ],
7 "psr-4": {
8 "App\\": "app/"
9 },
10 "files": [
11 "app/helpers.php" // <---- ADD THIS
12 ]
13},
14
152. After adding that to your composer.json file, run the following command:
16 composer dump-autoload
17
183. If you dont like keeping your helpers.php file in your app directory
19(because it is not a PSR-4 namespaced class file), you can do what the
20laravel.com website does: store the helpers.php in the bootstrap directory.
21Remember to set it in your composer.json file:
22
23"autoload": {
24 ..........
25
26 "files": [
27 "app/Helpers/helpers.php"
28 ]
29
30 ..............
31}