What’s New in Pricore 0.62: Mirror Packagist On Demand
Most PHP projects talk to two registries: Pricore for your private packages and Packagist for everything else. That works, but it means half of every install depends on a service you don’t control, your security audits only see your own code, and a CI pipeline without a warm cache fetches the same public archives from GitHub over and over.
v0.62.0 closes that gap. Pricore can now mirror Packagist on demand, so your projects install every package, private or public, from your own registry.
Why not just mirror all of Packagist?
Registry mirrors have always worked by importing everything a registry lists. That’s the right call for a Satis instance with a few dozen packages, and the wrong one for Packagist, which holds hundreds of thousands of packages and millions of versions. Your projects use a tiny fraction of them.
So mirrors get a second mode. An on-demand mirror doesn’t import anything up front. When Composer asks Pricore for a package it doesn’t have yet, Pricore fetches it from the mirror, stores its versions and answers the request. The next request for that package is served straight from Pricore. Your registry only ever holds the packages your projects actually use.
- 1
First install
Pricore imports the package from Packagist, answers Composer and stores the archive.
- 2
Every install after
Metadata and archives come straight from Pricore. Packagist isn’t asked.
- 3
In the background
Pricore checks for new releases when a package is used again, and every 4 hours.
Adding Packagist
Open Organization Settings → Registry Mirrors and click Add Mirror. You can now pick Packagist as the source. There is nothing to fill in: no URL, no credentials, no sync settings. Pricore shows what it is about to set up and you confirm with Add Packagist.
Once the mirror exists, its page shows the two commands that route a project through Pricore:
composer config repositories.acme composer \
https://pricore.yourcompany.com/acme
composer config repo.packagist false
The first adds your organization as a repository, the second stops Composer from asking Packagist directly. In composer.json that looks like this:
{
"repositories": [
{"type": "composer", "url": "https://pricore.yourcompany.com/acme"},
{"packagist.org": false}
]
}
From then on, composer install resolves every dependency through Pricore. Composer’s own metadata cache keeps working as before.
How it stays up to date
- First request: a package Pricore doesn’t know yet is imported from Packagist before the request is answered. Names Packagist doesn’t have either are remembered for 10 minutes, so a package that doesn’t exist anywhere doesn’t cost a Packagist request on every install.
- In the background: when a package is requested again after 5 minutes, Pricore checks Packagist for new releases in the background while serving what it has.
- On schedule: the regular mirror sync, every 4 hours, refreshes every package you imported.
If Packagist is down or returns an error, Pricore keeps the versions it already has. A failed request never empties a package.
Archives on first install
With Store archives in Pricore turned on, the first install of a version downloads its archive from upstream and stores it. Every install after that is served from your own storage. That makes builds faster, and it means a release stays installable even if its tag is later removed upstream or GitHub has a bad day.
Packagist archives come from GitHub, which allows 60 unauthenticated downloads an hour per IP address. Pricore downloads each archive only once, but the very first install of a large project can reach that limit. If you’d rather not store archives, turn the option off and Composer downloads them from GitHub itself.
The same behaviour is now available for every mirror. Turn on Download archives on first install when adding a regular mirror, and Pricore fetches archives as they’re needed instead of during every sync. For a large vendor registry where you only use a handful of packages, that saves a lot of storage.
Your public dependencies get audited too
Every package imported from an on-demand mirror goes through the same security auditing as your private packages. Pricore scans new and updated versions as soon as they arrive, so advisories for your public dependencies show up on your dashboard and in composer audit, right next to the ones for your own code.
Other large registries
Packagist is the obvious use case, but on-demand mirrors work for any Composer v2 registry. When you add a mirror under Other registry, choose On demand under Packages to import only what your projects ask for.
Filtering the package list
A Packagist mirror can add a lot of packages to your organization, so the package list now has filters. Search by name, narrow the list down by source (a repository, an upload or a specific mirror) and show only packages that are vulnerable or failed to sync. Filters live in the URL, so a filtered list is easy to share, and long lists are paginated.
Also in this release
- More reliable mirror downloads. Pricore now looks up a mirror host’s IPv4 and IPv6 addresses separately. A slow or failing IPv6 lookup no longer makes the whole host unreachable.
- PHP 8.5. A deprecation notice in the database configuration could break navigation on PHP 8.5. It’s gone.
- Dependencies. Laravel, Symfony components and phpseclib are updated to releases without known security advisories.
Availability
On-demand mirrors are part of every self-hosted installation and are turned on by default. Set MIRROR_ON_DEMAND_ENABLED=false to turn them off, for example on a shared installation where you don’t want users to add them.
On Pricore Cloud, on-demand mirrors aren’t offered for now. Regular registry mirrors, including archives on first install, are available as before.
Upgrading
-
Docker: pulling the new image is enough. Migrations run automatically on first boot.
-
Manual installations: run
php artisan migrate. Make sure your queue worker (Horizon) is running, since background refreshes and security scans of imported packages run on the queue. -
Release notes: View every Pricore release
-
Documentation: Mirroring Packagist
-
Cloud: Start your 14-day free trial
-
Self-hosted: View Pricore on GitHub