How to host your own private Packagist for free (or extremely cheap)

A private Packagist account can be too expensive for freelancers or small companies. Why not host your own, free?

Travis Weston
Level Up Coding
Published in
9 min readOct 24, 2021

--

Photo by Mildlee on Unsplash

I don’t think it’s too far to say that Composer and Packagist could be considered a turning point in the history of PHP. With the ability to include packages in your projects more easily, the community gathered around a single tool, and it quickly became the defacto standard for package management in PHP.

It didn’t take long for a market to develop for a private version that allowed us to host our packages but not make them available publicly. Packagist responded to this and created a Private Packagist product that does precisely that — secure access to packages at a premium price.

The price is worth every penny if you can afford it, but what about those of us that can’t or only want to host a few convenience packages for personal projects or freelance clients? That’s the problem we’re solving today.

Why not just use Packagist?

As of this writing, Packagist offers two versions of their Private Packagist product. A self-hosted version for large organizations over €1,260 per year, and a Cloud-hosted version comes in at a minimum of €49 per month, and an additional €14 per user, per month above three users.

If you need all of what Packagist offers, this price may be precisely what you’re looking for, and if that’s the case, you might as well quit reading and go sign up. Also, I’d be remiss if I didn’t mention that the folks over at Packagist are fantastic to work with, so if you’re not interested in doing all of this setup yourself, reach out to them for an unadvertised single-user plan.

The Project

If you’re like me, however, sometimes you want to build it yourself. I gave myself the challenge to create my package repository as cheap as I could. In my case, it wasn’t free, but I’ll cover those optional fees when we get to them.

This project takes almost no time to create and can be hosted on Heroku for free as long as you’re not using it very heavily. Bandwidth costs are the killer for this type of…

--

--

Travis Weston is a Software Developer focused on PHP, DevEx, and DevEd. Connect with him on Twitter @n00bJackleCity