Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

alev's avatar
Level 4

how do I publish and use a local composer repo in production?

I created a local composer repo in order to re-use the code in several projects. That works fine. In my projects I have the following lines in composer.json

require": {
        "php": "^7.2",
        "myrepos/mytool": "dev-master"
    },

and

"repositories": [
        {
            "type": "composer",
            "url": "https://nova.laravel.com"
        },
        {
            "type": "path",
            "url": "../../packages/mytool",
            "options": {
                "symlink": true
            }
        }
    ]

But, when I want to deploy this to production, my server (obviously) is not able to pull the package.

I have pushed it into a private repo on github: https://github.com/myrepos/mytoo, but I have no idea how I can tell composer to use in repositories the local composer repo for my local dev environment and the github repo for my production server.

Can someone point me to a how-to?

0 likes
2 replies
cookie's avatar

Take a look at the original documentation. =)

//Edit: @alev look at this answer:

{
    "repositories": [
        {
            "type": "vcs",
            "url": "https://github.com/igorw/monolog"
        }
    ],
    "require": {
        "monolog/monolog": "dev-bugfix"
    }
}
alev's avatar
Level 4

I created the question because I ran into an error when deploying my app to the production server. The error suggested that there is an issue with the local package, which is why I thought there is s special way to publish a local package to a production server.

But, it turns out there was some other issue. After running composer clear-cache it started to work again...

Please or to participate in this conversation.