PASSWORD RESET

Your destination for complete Tech news

How to create custom helper functions in Laravel

708 0
< 1 min read

To create custom helper functions in Laravel, you can create a custom helper.php file on the app folder and load it using the composer

Follow the steps below to use your custom helper function in Laravel.

Create a helper.php file in your app folder

Load the helper from your composer.json file

"autoload": {
    "classmap": [
        ...
    ],
    "psr-4": {
        "App\\": "app/"
    },
    "files": [
        "app/helpers.php" // INCLUDE THIS FILE
    ]
},

Finally, run composer dump autoload

composer dump-autoload

Leave A Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.