0

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!

Victor
  • 13,914
  • 19
  • 78
  • 147
  • Does this answer your question? [Composer : how to add a dependency without network connection?](https://stackoverflow.com/questions/26378840/composer-how-to-add-a-dependency-without-network-connection) – miken32 Dec 16 '20 at 18:01

1 Answers1

1

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
        }
    ]
}
Edi Modrić
  • 2,240
  • 1
  • 15
  • 18
  • Looks like I should've read the [docs](https://getcomposer.org/doc/05-repositories.md#disabling-packagist-org) better, eh? Thank you very much! Haven't tested it yet, but it surely works – Victor Jul 20 '19 at 12:20