Skip to content
Switch branches/tags
This branch is up to date with master.

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time

๐Ÿ“ฆ Packagist Mirror

Build Status docker Status docker pulls Minimum PHP Version Packagist Codecov Quality Score Mentioned in Awesome composer

This is repository make possible to you create a metadata mirror and keep in sync with

Mirror creation

โค๏ธ Recommended by โค๏ธ

If you're using PHP Composer, commands like create-project, require, update, remove are often used. When those commands are executed, Composer will download information from the packages that are needed also from dependent packages. The number of json files downloaded depends on the complexity of the packages which are going to be used. The further you are from the location of the server, the more time is needed to download json files. By using mirror, it will help save the time for downloading because the server location is closer.

โš™๏ธ How it works?

This project aims to create a local mirror with ease, allowing greater availability for companies/countries that want to use the composer but do not want to depend on the infrastructure of third parties. It is also possible to create a public mirror to reduce the load on the main repository and allow a better distribution of requests around the world, help us creating a public mirror!

When creating your local copy the child mirror (you) adds a list of other mirrors to use when creating your own mirror, if any mirror fails to deliver the metadata file the client automatically fetches the original file from the main mirror, could be or even another. If you lose your connection to the server or any other problem that prevents you from continuing is okay, it can return from where it stopped running. After the mirror is created, the next runs will only look for the main mirror delta optimally and efficiently.

Mirror creation

๐ŸŒŽ Packagist public metadata mirrors around the world

๐Ÿ›ซ Amazing data mirrors used to download repositories metadata built using this recommended repository or another:

Location Mirror Maintainer Github Sync
Brazil Webysther main Continuously
Thailand Mycools fork Every 5 minutes
China Eagle Wu fork Every minute
China Aliyun Every 5 minutes
China Shanghai Jiao Tong University fork Every hour
China Tecent Cloud Every day
Indonesia Indra Gunawan fork Every 30 seconds
Japan Hiraku forked Every 2 minutes
South Africa SolidWorx fork Every 5 minutes
South Korea PackagistKR fork Every minute

Not working as a mirror of (checked 2019-11):

Location Mirror Maintainer Github Reason Sync
China Huawei Cloud +100 packages not found, outdated until 2019-09, there no 2019$10 provider, sample working.
China No providers inside packages.json at least 2019-11
India Varun Sridharan fork Temporary server maintenance Wikimedia fork +100 packages not found, outdated until 2019-11

If you know any new mirror based or not on this one, please create a issue or a pull request with the new data.

Check status page for health mirror's.

World Map

The colors represent the topology drawn below, only show servers in better condition at country level.

๐Ÿš€ Create your own mirror


With docker and nginx:

The mirror creation save all data as .gz to save disk space and CPU, you need to enable reverse gz decode when a client ask for the decompressed version, normally used only for legacy composer clients.

Change you nginx configuration of gzip_static and gunzip as is:

Create a website on a default nginx instalattion:

sudo vim /etc/nginx/sites-available/
server {


    location / {
        try_files $uri $uri/ =404;
        gzip_static on;
        gunzip on;

๐Ÿ’กTip: use a machine with 2GB at least of memory, with that all metadata keep to the memory helping the nginx and disk to not be consumed at all.

After install nginx edit /etc/crontab:

* * * * * root docker run --name mirror --rm -v /var/www:/public \
-e APP_COUNTRY_NAME='Brazil' \
-e MAINTAINER_MIRROR='Webysther' \
-e URL='' \

to more options about image go to docker repository.

Put inside your ~/.*rc (~/.bashrc/~/.zshrc/~/.config/fish/

alias logs='watch -n 0.5 docker logs --tail 10 -t mirror'

Update your env vars and see monitoring packagist mirror creation:

source ~/.*rc

๐Ÿ‘ท Install

Using with docker repository or composer local:

$ git clone
$ cd packagist-mirror && composer install
$ cp .env.example .env

Schedule the command to create and update the mirror:

$ php bin/mirror create -vvv

๐Ÿง Development & Contributing

Please see CONTRIBUTING and CONDUCT for details.

๐Ÿ›ฃ๏ธ Roadmap

  • Translate and index of mirror.
  • More recipes to AWS/Azure/GCP/DigitalOcean and another cloud providers.
  • Support gz disabled for limited configuration access to Apache/Nginx.
  • Support full mirror mode (for countries/companies with limited access to internet).
  • Status report for all mirrors around the world.
  • Stats after initial mirror creation.

๐Ÿ“‹ Requirements

The following versions of PHP are supported by this version.

  • PHP >=7.2

๐Ÿงช Testing

$ vendor/bin/phpunit

๐Ÿฅ‚ Credits

๐Ÿ’™ Other correlated projects

  • Zencodex create a mirror
  • IndraGunawan create a mirror (outdated)
  • Hirak create a mirror (outdated)
  • Slince Easily switch to the composer repository you want

โ˜ฎ๏ธ License

MIT License. Please see License File for more information.

FOSSA Status


๐Ÿ‡น๐Ÿ‡ญ๐Ÿ‡น๐Ÿ‡ญThailand mirror packagist ๐Ÿ‡น๐Ÿ‡ญ๐Ÿ‡น๐Ÿ‡ญ




No packages published