Skip to main content

Pocus - PHP Package Installer and Runner

Pocus is a Python tool that simplifies PHP package management and execution. It automatically detects and installs the required PHP version based on composer.json requirements, downloads PHP packages, and provides an easy way to run bin scripts and PHP files.

Features

  • Automatic PHP Version Management: Detects required PHP version from composer.json and installs it
  • Package Installation: Installs PHP packages using Composer
  • Bin Script Execution: Runs bin scripts from installed packages
  • GitHub Repository Support: Downloads and installs packages directly from GitHub URLs
  • PHP File Execution: Runs PHP files using the installed PHP version
  • Cross-Platform: Works on macOS, Linux, and Windows
  • Multiple Architecture Support: Supports x86_64, arm64, and more

Installation

# Clone the repository
git clone https://github.com/pronskiy/pocus.git
cd pocus

# Install as a Python package (optional)
pip install -e .

Usage

Basic Usage

# Install a package and its dependencies
python -m pocus phpstan/phpstan

# Run a bin script from an installed package
python -m pocus phpstan/phpstan phpstan analyse path/to/code

# Run a PHP file using the installed PHP version
python -m pocus phpstan/phpstan script.php arg1 arg2

Installing from GitHub

# Install a package directly from GitHub
python -m pocus https://github.com/phpstan/phpstan

Version Constraints

Pocus supports various version constraints in composer.json:

{
    "require": {
        "php": "^7.4|^8.0"  // Will use PHP 8.0
    }
}

How It Works

  1. Pocus reads the PHP version requirement from composer.json
  2. It normalizes the PHP version to match available versions
  3. It downloads the appropriate PHP binary if it doesn't already exist
  4. It stores the PHP binary in ~/.pocus/{version}/
  5. It installs the requested package using Composer
  6. It executes bin scripts or PHP files as requested

Directory Structure

~/.pocus/
  ├── downloads/       # Temporary storage for downloaded archives
  └── {version}/       # Extracted PHP binaries for each version
      └── php          # PHP binary executable

Requirements

  • Python 3.6+
  • Internet connection for downloading PHP binaries and packages

Contributing

Contributions are welcome! Feel free to submit issues or pull requests.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Metadata

Release files for pocus 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pocus 0.1.2
File Size Uploaded Provenance Actions
pocus-0.1.2.tar.gz 8.8 kB Without provenance Details for pocus-0.1.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pocus 0.1.2
File Interpreter ABI Platform Actions
pocus-0.1.2-py3-none-any.whl Python 3 none any Details for pocus-0.1.2-py3-none-any.whl

Total release size: 19.5 kB

Release files / pocus-0.1.2.tar.gz

Download URL pocus-0.1.2.tar.gz
Size 8.8 kB
Tags Source
SHA-256 checksum
How to use checksums
2ee1a2dac3ef53905a7084ab44aec35471e6943bc8c352ee7342c6218e3e203f
BLAKE2b-256 checksum
How to use checksums
725380a6f11da4d2224b5e96be439c59b6dce49eb43aadb1bd1ecca391ce97ab
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.11.10

Release files / pocus-0.1.2-py3-none-any.whl

Download URL pocus-0.1.2-py3-none-any.whl
Size 10.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
67fa09d458c2ec2fbd0ddc06086918d45e6beb073cd4b190e21cf0875370a0ff
BLAKE2b-256 checksum
How to use checksums
2c141d12afe76ba0ff84d99faaf08b8a330c9e8ccbc9528c643fb1d2312d8cd6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.11.10

Security for pocus 0.1.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page