Home Backend Development PHP Tutorial Local Composer for Everyone! A Conference-Friendly Satis Setup

Local Composer for Everyone! A Conference-Friendly Satis Setup

Feb 10, 2025 pm 12:13 PM

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.

Local Composer for Everyone! A Conference-Friendly Satis Setup

Key Concepts:

  • Local Package Hosting: Satis creates a local repository, allowing network users to download packages without internet access.
  • satis.json Configuration: This file specifies repositories, versions, and download locations. It lists the necessary packages.
  • Time-Consuming Setup: Satis downloads all package versions and their binaries. Specifying exact versions is recommended for efficiency.
  • Offline/Unstable Network Use Cases: Ideal for conferences, offline development, or as a backup for corporate Packagist access.

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:

  1. Install Satis: composer create-project composer/satis --stability=dev --keep-vcs
  2. Create 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" }
}
Copy after login
<code>*Note:  `require-all` is inefficient.  Specifying exact package versions is advised for faster builds.*</code>
Copy after login
  1. Build the Repository: php bin/satis build satis.json web/ (This may require a Github token).
  2. Host the Repository: Start a simple PHP web server: cd web; php -S 0.0.0.0:6789
  3. Access the Repository: Access via the host machine's IP address and port (e.g., 192.168.5.11:6789 or a hostname).

Local Composer for Everyone! A Conference-Friendly Satis Setup

Client-Side Usage:

  1. Add Host Entry (if using hostname): Add the hostname and IP address to the client machine's /etc/hosts file.
  2. Add Repository to composer.json:
{
    "repositories": [
        {
            "type": "composer",
            "url": "http://nofw.websc:6789"
        }
    ],
    "config": { "secure-http": false }
}
Copy after login
  1. Install Packages: composer require twig/twig beelab/bowerphp

Local Composer for Everyone! A Conference-Friendly Satis Setup

Troubleshooting:

  • Windows Intranet Issues: Ensure all devices are on the same router/extender.
  • Connection Refused: Verify port forwarding in Homestead.yaml or Vagrantfile.
  • Alternatives to Ngrok/Localtunnel: These require internet access; Satis is for local network sharing.

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!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Explain JSON Web Tokens (JWT) and their use case in PHP APIs. Explain JSON Web Tokens (JWT) and their use case in PHP APIs. Apr 05, 2025 am 12:04 AM

JWT is an open standard based on JSON, used to securely transmit information between parties, mainly for identity authentication and information exchange. 1. JWT consists of three parts: Header, Payload and Signature. 2. The working principle of JWT includes three steps: generating JWT, verifying JWT and parsing Payload. 3. When using JWT for authentication in PHP, JWT can be generated and verified, and user role and permission information can be included in advanced usage. 4. Common errors include signature verification failure, token expiration, and payload oversized. Debugging skills include using debugging tools and logging. 5. Performance optimization and best practices include using appropriate signature algorithms, setting validity periods reasonably,

How does session hijacking work and how can you mitigate it in PHP? How does session hijacking work and how can you mitigate it in PHP? Apr 06, 2025 am 12:02 AM

Session hijacking can be achieved through the following steps: 1. Obtain the session ID, 2. Use the session ID, 3. Keep the session active. The methods to prevent session hijacking in PHP include: 1. Use the session_regenerate_id() function to regenerate the session ID, 2. Store session data through the database, 3. Ensure that all session data is transmitted through HTTPS.

Describe the SOLID principles and how they apply to PHP development. Describe the SOLID principles and how they apply to PHP development. Apr 03, 2025 am 12:04 AM

The application of SOLID principle in PHP development includes: 1. Single responsibility principle (SRP): Each class is responsible for only one function. 2. Open and close principle (OCP): Changes are achieved through extension rather than modification. 3. Lisch's Substitution Principle (LSP): Subclasses can replace base classes without affecting program accuracy. 4. Interface isolation principle (ISP): Use fine-grained interfaces to avoid dependencies and unused methods. 5. Dependency inversion principle (DIP): High and low-level modules rely on abstraction and are implemented through dependency injection.

How to debug CLI mode in PHPStorm? How to debug CLI mode in PHPStorm? Apr 01, 2025 pm 02:57 PM

How to debug CLI mode in PHPStorm? When developing with PHPStorm, sometimes we need to debug PHP in command line interface (CLI) mode...

Framework Security Features: Protecting against vulnerabilities. Framework Security Features: Protecting against vulnerabilities. Mar 28, 2025 pm 05:11 PM

Article discusses essential security features in frameworks to protect against vulnerabilities, including input validation, authentication, and regular updates.

How to automatically set permissions of unixsocket after system restart? How to automatically set permissions of unixsocket after system restart? Mar 31, 2025 pm 11:54 PM

How to automatically set the permissions of unixsocket after the system restarts. Every time the system restarts, we need to execute the following command to modify the permissions of unixsocket: sudo...

Explain late static binding in PHP (static::). Explain late static binding in PHP (static::). Apr 03, 2025 am 12:04 AM

Static binding (static::) implements late static binding (LSB) in PHP, allowing calling classes to be referenced in static contexts rather than defining classes. 1) The parsing process is performed at runtime, 2) Look up the call class in the inheritance relationship, 3) It may bring performance overhead.

See all articles