You can follow this post by https://twitter.com/aschmelyun
https://aschmelyun.com/blog/installing-a-local-composer-package-in-your-php-project/
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I added my repository to composer.json:
"repositories": [
{
"type": "composer",
"url": "http://localhost/"
}
],
And then added some random package to the require block, in this case doctrine/inflector:
"require": {
"php": "^8.0.2",
"guzzlehttp/guzzle": "^7.2",
"laravel/framework": "^9.19",
"laravel/sanctum": "^3.0",
"laravel/tinker": "^2.7",
"doctrine/inflector": "2.0.4"
},
Then I deleted it from vendor, deleted composer.lock and ran composer install. But the new composer.lock still has the GitHub url of this package instead of my localhost:
"name": "doctrine/inflector",
"version": "2.0.4",
"source": {
"type": "git",
"url": "https://github.com/doctrine/inflector.git",
},
How can I make Composer install packages from my localhost repository?
@Ligonsker delete composer.lock and try again
Please or to participate in this conversation.