Home > Back-end >  How to install a forked laravel package of Github in Laravel?
How to install a forked laravel package of Github in Laravel?

Time:01-09

I forked a package and after the changes, I want to install it in the laravel project I put the address of the package in the composer.json file, but I failed to install it

"repositories":
[
    {
        "type": "vcs",
        "url": "https://github.com/....."
    }
],

CodePudding user response:

To install a forked Laravel package from GitHub in your Laravel project, you can use Composer. Here are the steps you can follow:

Go to the GitHub repository of the forked package and copy the HTTPS clone URL. In your terminal, navigate to the root directory of your Laravel project. Run the following command to add the package as a dependency to your project:

composer require "vendor/package-name:dev-branch-name"

Replace vendor/package-name with the name of the package, and branch-name with the name of the branch you want to install.

If the package has any service providers or facade aliases that need to be registered, you will need to add them to the providers and aliases arrays in your config/app.php file.

If the package has any assets that need to be published, you can use the following command to publish them:

php artisan vendor:publish --provider="Vendor\Package\PackageServiceProvider"

Replace Vendor\Package\PackageServiceProvider with the fully qualified namespace of the package's service provider.

That's it! You should now be able to use the forked Laravel package in your project.

  • Related