DEV Community

Koussay
Koussay

Posted on

How to test a Laravel package locally

Howdy!

Lately I’ve been working on submitting a PR to a package, Laravel package to be precise.

I forked & cloned the project to my local machine. I made my adjustments, and then I want to test it, because it has a visual interface.

But I had a problem linking it an existing Laravel app to see those adjustments. So reading Composer docs, I found “Repositories”, and you can use it to link a local composer package, How ?

First of all, after cloning or creating your own package, you can link it in your main application by editing composer.json, adding this :


"repositories": [
        {
            "type": "path",
            "url": "../../awesome/package"

        }
    ]

Enter fullscreen mode Exit fullscreen mode

Note: the url must be the full path to the package.
After that, add the package to the require section

And finally

composer update
Enter fullscreen mode Exit fullscreen mode

Composer now will link the package to the main app, and any change you make in the package will be reflected immediately into your app.
Thank you for reading.

Top comments (0)