Use your bundle locally by path in composer

Composer symlink for packages

I cross around the net and could not find fast the solution for using package locally instead of passing by packagist(satis, any other hub).

Let’s imagine the situation when you have project and bundle you code yourself for it. Let’s say your project s1 and your bundle is loaders.

It’s not really comfortable to code without executing the final bundle code in your project. You need pass by repository, merge your changes, CI/CD pipelines, so on… just to execute it.

Use composer symlink

The solution I found using your bundle directly in your project during development and not by repository.

You can add a symlink to the bundle in your project compose and simply run composer install. Simply add repositories section to composer.json

"repositories": [
{
"type": "path",
"url": "/tmp/loaders",
"options": {
"symlink": true
}
}
],

Where /tmp/loaders is the path to your dependency.

A few packages

If you have a folder which contains multiple packages then you can set the folder of packages

"url": "path/to/your/packages/*"

Next you have to update the "require" or"require-dev" section.

"require": {
...
"your/package": "*"
...
}

Composer install

Nextly we run composer install

composer install

And one of the changes you should note that your dependency comes from /tmp/loaders instead of public repository.

Take alytvynov/loaders from local path.

That’s it, now when you change the code in your loaders folder you ll see the modifications immediately in your project.

Result — Repositories

You can check the code for this part here:

Thank you for your attention.

LinkedIn, Twitter, https://lytvynov-anton.com

--

--

--

Senior web developer, architect, cryptocurrencies trader, https://lytvynov-anton.com

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Using an Ubuntu EC2 as your Docker dev machine

Immutable Objects In Java

Azure Functions SDK update of CosmosDB Trigger — Identity Based Connections

The Beginners’ Guide to map, zip, and Filter Functions in Python

Picking the next thing to learn is difficult — I guess picking the first thing to ‘get into’…

A Case Study in DevOps Continuous Improvement

Kubernautic Data Platform for DataOps & MLOps

Querying real time video with serverless ML

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Anton Lytvynov

Anton Lytvynov

Senior web developer, architect, cryptocurrencies trader, https://lytvynov-anton.com

More from Medium

The Typed Data API, by example

GitHub - mglaman/drupal-typed-data-by-example: Drupal's Typed Data API by example

Adding a watermark to a video in PHP

How to Run Symfony Console Command in AWS Lambda

Create a script to compress folders in ZIP with PHP