Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

I am creating a helper function for my custom package in laravel

Laravel 8, PHP 8.0

here is helper function autoload array in package composer.json

"autoload": {
    "psr-4": {
        "Chatify\\": "src/"
    },
    "files": [
        "src/helper.php"
    ]
},

But When I try to call helper by any of its function inside blade file or in the controller its did not detect it. Its only detect the Application helper file.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

I have trid these command composer dumpautoload and composer update, but it did not help.

I am trying to create a helper function for my custom package. I dont want to use Laravel Application Helper Function.

>Solution :

Its Already Solved here

Creating a custom helper in own package in laravel

Could not solve it by composer independently and used my package service provider. I added this code to the boot() method of my FaviconServiceProvider and it works now:

if (File::exists(__DIR__ . '\app\helpers.php')) {
            require __DIR__ . '\app\helpers.php';
        }
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading