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

Dreamer's avatar

Composer and GitLab's private packages

Hello So im new with git. Last year I started to learn Laravel and with that, i get to know composer quite well and found out what i was missing all this time :). But i never used git for my own code/projects before because github only allowed private packages to paying customers. I didnt feel like paying every month so couple of my packages could just sit there.

But, then i found out that GitLab allows hosting of private packages and only asking money for support and, i believe, for other special things. So, today i introduced myself into the world of git. How amazing was that...

Okay, to the point. Im a bit lost as how to allow composer to get private packages from gitlab? I tried to google it but did not find any answers.

Secondly, how could i require a package from my ssd when in dev mode but require the same package from GitLab when in production? In essence, i want so the websites that i currently work on would always have the latest version of packages with all of the changes, without me having to commit and then do a composer update to check if every single minor change works.

Or how do you handle working with a project that require many your own private packages when you update all of them frequently. Whats the best practice?

0 likes
2 replies
ohffs's avatar

You could try the steps outlined in the composer docs? Just use the url gitlab give you.

For your second question - that'd be a little tricky without over-riding the packages I think (thought would be gladly shown to be wrong!). You could maintain two different composer files (ie, composer_prod.json and composer_dev.json) and set the COMPOSER environment variable to point to the right one - but it's a bit messy :-/

Dreamer's avatar

Thanks @ohffs

I guess ill commit and push and composer update while working with laravel packages... but i suspect it will get old fast.

I wonder if there is better way to test the packages... maybe i could use special laravel test project where i hard-include every package i work on. I wonder how to do that - to make laravel use external packages as if they were in vendor folder (installed packages).

Please or to participate in this conversation.