1# How to register utilities class on Laravel 5.8
2# File: composer.json
3# ref: https://stackoverflow.com/questions/28290332/best-practices-for-custom-helpers-in-laravel-5
4"autoload": {
5 "classmap": [
6 ...
7 ],
8 "psr-4": {
9 "App\\": "app/"
10 },
11 "files": [
12 "app/helpers.php" // <---- ADD THIS
13 ]
14},
15
16 # Then run: `composer dump-autoload`
1Create 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
15After adding that to your composer.json file, run the following command:
16
17composer dump-autoload
18