Cheatsheet - Register a local laravel package during development

Nav • March 10, 2021

package-development laravel

How to register a package in Laravel from a local folder, during package development.

I am a big fan of Spatie's package skeleton repo. Its a really good starting point for package development. Use it as a template. Clone it to a local folder. Lets use package-dev as a example package folder.

Create a new laravel project, or use an existing project.

laravel new demo-project

Update the composer file in demo-project. Add the following to require or require-dev, whichever fits your needs.

"your-github-username/package-dev": "dev-master"

Then add the location for that package. The url points to package-dev folder. In this case package-dev and demo-project reside in the same root folder.

"repositories": [
        "type": "path",
        "url" : "../package-dev"

Now you can run the update command in demo-project folder.

composer update

Your local package-dev should now be registered in demo-project.