Creating a Helpers File in Laravel 5

In this post, we are going to create a helpers file in Laravel. We can use this file to put our custom helper functions which we use to perform the repetitive tasks.

To Create a helpers file follow the steps given below:

Step 01:

Create a helpers.php within your app folder.

Step 02:

Specify that file name within composer.json file.

"autoload": {
    "classmap": [
    "psr-4": {
        "App\\": "app/"
    "files": [
        "app/helpers.php" // <---- Add this line to Autoload helpers file

Step 03:

After adding the above line to your composer.json file, run the following command.

$ composer dump-autoload



Leave a Comment.