15 Nov

How to create Helpers file in Laravel 5

In this tutorial i will tell you how to create a helpers file in Laravel 5 where you can define your custom functions and call them like normal php functions.

  1. Create file app/helpers.php and define custom functions in your file.
  2. Now we just need to autoload our helpers file so that all the functions defined are available throughout the application.  Open composer.json file and in the files array under autoload object add “app/helpers.php” as shown below:
  3. Run command: composer dump-autoload

Now you can easily define and use your custom helper functions throughout the application.

 

 

The following two tabs change content below.

Vineet Garg

Sr. Web Developer at GuestHouser
I am passionate about technology and web development.

Latest posts by Vineet Garg (see all)