Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

NetTuts.com:
How to Create a Laravel Helper
Apr 21, 2017 @ 20:15:28

On the NetTuts.com site there's a new tutorial from author Sajal Soni showing you how to create a custom Laravel helper, a set of helper functions that can be used through out the entire application.

Laravel includes a variety of global "helper" PHP functions. Many of these functions are used by the framework itself; however, you are free to use them in your own applications if you find them convenient. So, basically, helpers in Laravel are built-in utility functions that you can call from anywhere within your application. If they hadn't been provided by the core framework, you might have ended up developing your own helper classes.

Although the core provides a variety of helpers already, there’s always a chance that you’ll need your own and would like to develop one so you don’t have to repeat the same code here and there, thus enforcing better maintainability. You'll learn how to create a custom Laravel helper in this tutorial.

They start by talking about some of the current helpers and the functionality they relate to (arrays, paths, strings, etc). It then goes into the creation of the custom helper including the skeleton of the code layout, where to place them and how to load them into the application via a service provider.

tagged: custom laravel helper function creation tutorial

Link: https://code.tutsplus.com/tutorials/how-to-create-a-laravel-helper--cms-28537


Trending Topics: