php - How do I activate a Laravel package via dowloaded files (not via Composer)

I have a Laravel package I would like to use in my project. I have tested it already and I know I'd need to customize quite a lot of it to fit my needs.

Overriding files in the vendor directory is always quite a chore, especially if you need to touch PHP, Vue, CSS files, etc. Hence, I don't want to go via the usual Composer installation. I also don't care much about future updates to the package, as it already has a solid base.

So the question is: After I download the package files from GitHub and after I place them in their respective directories in my Laravel app - is there a specific list of steps to take in order to make sure the inserted package works? Or is it more like, do it and fix issues one by one until it works?

Cheers.

Answer

Solution:

Composer allows you to choose the local package instead of the remote one.

  1. Create a packages folder in the base directory (the packages folder and Laravel's composer.json file must be in the same directory).

  2. Put your downloaded package into packages (packages/packageName).

  3. Replace the following line in your Laravel's composer.json.

    "require": {
    

    by

    "repositories": [
        {
            "type" : "path",
            "url" : "./packages/*",
            "options" : {
                "symLink" : true
            }
        }
    ],
    "require": {
    
  4. Run composer require authorName/packageName command in the console.

Source