Installing composer packages locally

3 weeks ago | 1 minute read | Laravel | PHP | Wordpress

Photo by <a href="https://unsplash.com/@benofthenorth">Ben Griffiths</a> on <a href="https://unsplash.com">Unsplash</a>

I think it is best I dive into this one with a use case.

Let's say you working on a package locally that's yet to be published or better still won't be published on packagist.org or will be hosted on a private server and you need to test the installation or start the integration while the package is offline.

Here's your guide. First, we will need to add this to your composer.json

"repositories": [
    {
        "type": "path",
        "url": "./../package-path"
    }
],

Next up, we will need to require the dev version of the package like:

"maintainer/package-name": "*@dev"

Update your packages via composer to have the localy package installed..

Easy.