Introduction
Adding custom helpers can assist you with your development speed. There are a few things to take into consideration while writing such helper functions though, hence this tutorial.
Just a few pointers:
- We've put the function definitions within a check (
function_exists
) to prevent exceptions when the service provider is called twice.
- An alternative way is registering the helpers file from the
composer.json
file. You can copy the logic from the laravel framework itself.