by Devin Yang
(This article was automatically translated.)

Published - 6 years ago ( Updated - 6 years ago )

In Laravel's framework, it contains quite a lot of PHP functions (php functions), called helpers.
https://laravel.com/docs/5.6/helpers
So how do we customize our own helper in Laravel? It's actually quite simple..
Just add files in autoload in composer.json.
 "autoload": {
        "files": [
            "app/ow_source/_functions.php"
        ],
        "classmap": [
            "database/seeds",
            "database/factories"
        ],
        "psr-4": {
            "App\\": "app/",
            "Ow\\": "app/ow_source/class",
            "Ow\\Model\\": "app/ow_source/model"
        }
    },
In this way, we can call our function anytime and anywhere.

Tags: laravel

Devin Yang

Feel free to ask me, if you don't get it.:)

No Comment

Post your comment

Login is required to leave comments

Similar Stories


Laravel, Packages,

What packages do you have to install on all Laravel applications you build?

What kind of packages are you sure to install on your Laravel application? There are four-star kits here, almost everyone will install them, Click here to see, how do I say, my actual use experience sharing...

laravel

Basic application teaching of jenkins CI Server pipeline on Laravel

Do you want to build a continuous integration and delivery CI Server for Laravel through docker? Execute laravel dusk and phpunit on CI Server to easily handle automated testing and related records. After reading this article, you may find out how simple CI/CD is. I mean basic use.

laravel

Introduced by @dump, new features in Laravel 5.6.8

In the directive of Laravel 5.6, there is a new function called @dump Let's see how cool he is.