Ad

How To Use Laravel Libraries In Laravel Project Without Composer

- 1 answer

I have libraries which I used to use repeatedly and have to be able to add it to Laravel project with the version I already download it before on local and may use it event with no internet connection is it possible to add it to Laravel in some way like Composer or is it possible to build my own local composer?

Ad

Answer

You can use the autoload mapping in order to adchieve that. Just create a folder with the file/files that you want to use. For example:

YourProject/app/MyClasses/

And store the files right there. Then you just have to use the composer classmap: Edit the composer.json file indicating the path to your classes:

"autoload": {
    ...
    "classmap": [
        "database/seeds",
        "database/factories"
        "app/MyClasses"
    ],
    ...
},

Run the composer dump-autoload command and you'll be ready to go.

Ad
source: stackoverflow.com
Ad