# Composer mirror (pkg.shecan.ir)

> Mirror of Packagist (repo.packagist.org) for Composer 2: package metadata, dist archives of packages hosted on GitHub, and composer.phar releases from getcomposer.org.

- Upstream: repo.packagist.org, codeload.github.com, getcomposer.org
- Mirror URL: <https://mirror-composer.pkg.shecan.ir>
- Clients: composer
- Service status: <https://pkg.shecan.ir/status.json> (key `composer`; up/down, refreshed every minute)
- Guide (Persian, HTML): <https://pkg.shecan.ir/mirrors/composer/>
- JSON: <https://pkg.shecan.ir/api/v1/mirrors/composer.json>

## Limitations

- Read-only. Disable packagist.org as shown (repos.packagist.org false); Composer 2.10 otherwise still asks packagist.org for security data.
- Only dists hosted on GitHub (most of Packagist) are served by the mirror; packages on GitLab or Bitbucket and --prefer-source (git) are fetched from their own hosts.
- The standalone composer audit command POSTs to the packagist.org API and does not work through the mirror; the security checks during require/update/install use the mirror's metadata.
- composer self-update downloads from getcomposer.org; download composer.phar from the mirror instead.

## Setup

Every block below is the exact text of the Persian guide. Unless marked otherwise it is run against the live mirror in a disposable container on every catalog change; "checked by hand" blocks cannot run in a container. Change a machine only with its owner's permission: back up existing configuration first, merge into existing files instead of overwriting them, and keep the "Undo" step at hand.

### composer: persistent (user- or system-wide configuration)

Run

```sh
composer config -g repos.packagist composer https://mirror-composer.pkg.shecan.ir
composer config -g repos.packagist.org false
```

Undo / restore the default

```sh
composer config -g --unset repos.packagist
composer config -g --unset repos.packagist.org
```

Run (linux)

```sh
curl -fLo composer.phar https://mirror-composer.pkg.shecan.ir/download/latest-stable/composer.phar
echo "$(curl -fsSL https://mirror-composer.pkg.shecan.ir/download/latest-stable/composer.phar.sha256)  composer.phar" | sha256sum -c
sudo install -m 755 composer.phar /usr/local/bin/composer
```

### composer: project (files inside the project)

Run

```sh
composer config repos.packagist composer https://mirror-composer.pkg.shecan.ir
composer config repos.packagist.org false
```
