npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

php-composer-cli

v1.0.0

Published

PHP and Composer as npm CLI package — automatically downloads PHP binaries and Composer for the current platform

Readme

php-composer-cli

An npm CLI package that automatically downloads PHP and Composer for your current platform and exposes them as php and composer terminal commands.

Supported platforms

| OS | Arch | PHP binary source | |---------|-------|---------------------------------------------------------------------------------------------| | Linux | x64 | crazywhalecc/static-php-cli | | Linux | arm64 | crazywhalecc/static-php-cli | | macOS | x64 | crazywhalecc/static-php-cli | | macOS | arm64 | crazywhalecc/static-php-cli | | Windows | x64 | shivammathur/php-builder-windows |

PHP version is resolved from php/php-src releases.
Composer is resolved from composer/composer releases.

Installation

Global (recommended)

npm install -g php-composer-cli

During install, the postinstall script automatically downloads the correct PHP binary and composer.phar into the package's dist/ folder.

Local (per-project)

npm install php-composer-cli
npx php --version
npx composer --version

Usage

After a global install:

# Check versions
php --version
composer --version

# Run a PHP script
php my-script.php

# Create a new Laravel project
composer create-project laravel/laravel my-app

# Install dependencies from composer.json
composer install

# Add a package
composer require guzzlehttp/guzzle

Project structure

php-composer-cli/
├── bin/
│   ├── php.js          # `php` CLI wrapper
│   └── composer.js     # `composer` CLI wrapper
├── dist/               # Downloaded binaries (created at install time)
│   ├── php  /  php.exe
│   └── composer.phar
├── lib/
│   ├── github.js       # GitHub Releases API helpers
│   ├── platform.js     # Platform detection + version resolution via GitHub API
│   └── download.js     # HTTP download + archive extraction
├── install.js          # postinstall script
└── package.json

How it works

  1. npm install triggers the postinstall script (install.js).
  2. The script detects the OS and CPU architecture.
  3. PHP version is resolved via the GitHub Releases API of the official php/php-src repository.
  4. PHP binary (precompiled static executable) is downloaded from GitHub releases — no build step required:
  5. Composer (composer.phar) is downloaded from composer/composer GitHub releases — the official Composer repository.
  6. Both are placed in dist/.
  7. bin/php.js and bin/composer.js are thin wrappers that delegate all CLI arguments via child_process.spawnSync.

Updating PHP / Composer

To force a fresh download (e.g. after a new PHP or Composer release), delete dist/ and run npm install again:

rm -rf node_modules/php-composer-cli/dist
npm install

Versions are always resolved dynamically from GitHub — no manual edits needed.

License

MIT