composer-phpsatis

Cannot make composer install work offline


I am trying to set up Composer to work without internet access. I have set up a server in the local network with a Satis configured repository with the following configuration file:

{
  "name": "private/composer",
  "homepage": "http://<some_ip>:9500",
  "repositories": [
    {"type": "composer", "url": "https://packagist.org"}
  ],
  "require-dependencies": true,
  "require": { ... },
  "archive": {
    "directory": "offline",
    "format": "zip"
  },
  "config": {
    "preferred-install": "dist"
  }
}

After running

$ ./satis/bin/satis build ./satis.json ./mirror

Everything works, I get my ./satis/mirror/offline directory filled up with .zip files of the packages I am mirroring from packagist.org.

In my Composer, project, I added the following sections to the composer.json configuration:

{
    "repositories": [{
        "type": "composer",
        "url": "http://<some_ip>:9500"
    }],
    "config": {
        "secure-http": false
    },
    ...
}

I tried to run composer install then and I get an error about Composer not begin able to access https://packagist.org/packages.json. Why is it trying to do that? How can I make this process work without internet access?

Thank you!


Solution

  • By default Composer does not disable access to packagist.org when you add custom repos. You can disable it with the following config:

    {
        "repositories": [
            {
                "packagist.org": false
            }
        ]
    }