This article explains how to set up a local Satis instance to host Composer packages over a network, enabling offline package retrieval. It eliminates the need for an internet connection for accessing packages.
Key Concepts:
satis.json
Configuration: This file specifies repositories, versions, and download locations. It lists the necessary packages.The author uses Homestead Improved for the setup, but a standard PHP environment or Docker is also suitable. A shared port (e.g., 6789) needs to be configured in Homestead.yaml
.
Satis Setup Steps:
composer create-project composer/satis --stability=dev --keep-vcs
satis.json
: This file lists the required packages (using their full Github URLs for VCS repositories). The example includes many packages:{ "name": "NoFW Websc", "homepage": "http://nofw.websc:6789", "repositories": [ // ... (List of Github repositories) ... ], "require-all": true, "require-dependencies": true, "require-dev-dependencies": true, "archive": { "directory": "dist" } }
<code>*Note: `require-all` is inefficient. Specifying exact package versions is advised for faster builds.*</code>
php bin/satis build satis.json web/
(This may require a Github token).cd web; php -S 0.0.0.0:6789
192.168.5.11:6789
or a hostname).Client-Side Usage:
/etc/hosts
file.composer.json
:{ "repositories": [ { "type": "composer", "url": "http://nofw.websc:6789" } ], "config": { "secure-http": false } }
composer require twig/twig beelab/bowerphp
Troubleshooting:
Homestead.yaml
or Vagrantfile
.Conclusion:
Satis provides a simple way to create a local Composer repository, ideal for offline or unstable network environments. It's useful for conferences, corporate backups, and even portable setups using a Raspberry Pi.
Frequently Asked Questions (FAQs): (The original FAQs are included in the output, as they are relevant and don't need modification for paraphrasing.)
The above is the detailed content of Local Composer for Everyone! A Conference-Friendly Satis Setup. For more information, please follow other related articles on the PHP Chinese website!