Skip to main content

A short description

Project description

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pocus-0.1.1.tar.gz (8.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pocus-0.1.1-py3-none-any.whl (10.7 kB view details)

Uploaded Python 3

File details

Details for the file pocus-0.1.1.tar.gz.

File metadata

  • Download URL: pocus-0.1.1.tar.gz
  • Upload date:
  • Size: 8.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.10

File hashes

Hashes for pocus-0.1.1.tar.gz
Algorithm Hash digest
SHA256 a8248e10d2778599e5053d50b3a495b6ddf6c5afdb9e393d7e0330c1db2ba27b
MD5 24a2ced553eb7bc1ea9c288235c7d5e0
BLAKE2b-256 5db4c08a8bc63c8ffc4fc962b83b3681649b72f3e2fc6a82777a379209350c38

See more details on using hashes here.

File details

Details for the file pocus-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: pocus-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 10.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.10

File hashes

Hashes for pocus-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 6d5dea4af3c5d66a363c296590b4763944af1c28f7ea18588536277315131f2f
MD5 3ed9c72420726b1f4f755057eea69ee9
BLAKE2b-256 26bf640ce38b0b9b3ecca78fd0e7d9f3c25e735568b42874365720ec3c24e279

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page