Helper file in very useful to create custom helper functions in Laravel app. We can use these custom helper functions app-wide.
First create the file app/helpers.php
.
Then either load this file in any of the core Laravel file that autoloads when the application starts. Like,
require app_path() . '/helpers.php';
OR, change your composer.json file and dump the autoloader.
Example:
"autoload": { "classmap": [ "database" ], "psr-4": { "App\\": "app/" }, "files": [ "app/helpers.php" ] },
Then Run: composer dump-auto or composer dump-autoload