PHPackages                             syntaxx/phpx-build-tools - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. syntaxx/phpx-build-tools

ActiveLibrary

syntaxx/phpx-build-tools
========================

Build tools for PHPX WebAssembly projects

v0.2.0(6mo ago)0211MITPHPPHP &gt;=8.3

Since Oct 26Pushed 6mo agoCompare

[ Source](https://github.com/Syntaxx-HQ/PHPX-BuildTools)[ Packagist](https://packagist.org/packages/syntaxx/phpx-build-tools)[ RSS](/packages/syntaxx-phpx-build-tools/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (2)Dependencies (3)Versions (4)Used By (1)

PHPX Build Tools
================

[](#phpx-build-tools)

Build tools and CLI utilities for PHPX WebAssembly projects.

Overview
--------

[](#overview)

This package provides the build system for PHPX applications, handling compilation, bundling, and deployment of PHP applications to WebAssembly.

Features
--------

[](#features)

- **Build System**: Compile and pack PHPX applications for WebAssembly
- **Watch Mode**: Auto-rebuild on file changes during development
- **Vendor Optimization**: Smart caching of production dependencies
- **Fast Builds**: Cached vendor directory for quick rebuilds
- **Clean Architecture**: Build artifacts in temporary directories

Installation
------------

[](#installation)

```
composer require syntaxx/phpx-build-tools --dev
```

Usage
-----

[](#usage)

### Build Your Application

[](#build-your-application)

```
# Full build (pack + export)
vendor/bin/phpx-build build

# Pack only
vendor/bin/phpx-build pack

# Export only
vendor/bin/phpx-build export
```

### Watch Mode (Auto-rebuild)

[](#watch-mode-auto-rebuild)

```
vendor/bin/phpx-build watch
```

### Composer Scripts Integration

[](#composer-scripts-integration)

Add to your `composer.json`:

```
{
    "scripts": {
        "wasm": "phpx-build build",
        "wasm:watch": [
            "Composer\\Config::disableProcessTimeout",
            "phpx-build watch"
        ]
    }
}
```

How It Works
------------

[](#how-it-works)

### Build Process

[](#build-process)

1. **Temporary Build Directory**: Creates `/tmp/phpx-build/{project}-{hash}`
2. **File Copy**: Copies `bootstrap.php`, `src/`, and vendor files
3. **Vendor Optimization**: Uses cached production vendor (no dev dependencies)
4. **PHPX Compilation**: Transforms PHPX files to standard PHP
5. **WebAssembly Packing**: Bundles everything into `.wasm` data file
6. **Export**: Copies build artifacts to `public/build/`
7. **Cleanup**: Removes temporary directory

### Vendor Caching

[](#vendor-caching)

The build system caches the vendor directory based on `composer.json` and `composer.lock` hashes:

- **Cache Hit**: Reuses existing vendor (~0.4s build time)
- **Cache Miss**: Runs `composer install --no-dev` and caches result

Cache location: `/tmp/phpx-build/{project}-vendor-{hash}`

### Watch Mode

[](#watch-mode)

Monitors for changes in:

- `src/` directory (PHP/PHPX files)
- `composer.json` (dependencies)
- `composer.lock` (dependency lock)

Features:

- Initial build on startup
- 2-second debouncing to prevent excessive rebuilds
- Colored output with clear status messages
- Excludes temporary files and editor backups

Configuration
-------------

[](#configuration)

Create a `phpx-build.json` in your project root:

```
{
    "build": {
        "src": "src",
        "output": "public/build",
        "bootstrap": "bootstrap.php"
    },
    "watch": {
        "paths": ["src", "composer.json", "composer.lock"],
        "exclude": ["*.swp", "*.tmp", "~"]
    }
}
```

Requirements
------------

[](#requirements)

- PHP 8.3 or higher
- `inotify-tools` (for watch mode on Linux)

### Installing inotify-tools

[](#installing-inotify-tools)

```
# Ubuntu/Debian
sudo apt-get install inotify-tools

# Fedora/RHEL
sudo yum install inotify-tools

# Arch Linux
sudo pacman -S inotify-tools
```

Integration with PHPX Ecosystem
-------------------------------

[](#integration-with-phpx-ecosystem)

This package is designed to work seamlessly with:

- **PHPX-Compiler**: Transforms PHPX syntax to PHP
- **WebAssemblyPacker**: Bundles files for WebAssembly
- **PHPX-Framework**: React-like component framework
- **PHPX-WasmRuntime**: Runtime for executing PHP in browser

Development
-----------

[](#development)

```
# Clone the repository
git clone https://github.com/syntaxx/phpx-build-tools
cd PHPX-BuildTools

# Install dependencies
composer install

# Run tests
composer test
```

License
-------

[](#license)

MIT License - see LICENSE file for details.

Contributing
------------

[](#contributing)

Contributions are welcome! Please submit pull requests or open issues on GitHub.

Credits
-------

[](#credits)

Part of the [PHPX ecosystem](https://github.com/syntaxx) - bringing React-like development to PHP with WebAssembly.

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance66

Regular maintenance activity

Popularity6

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity42

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~6 days

Total

2

Last Release

198d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1073586?v=4)[Øystein Kambo Tangerås](/maintainers/kambo)[@kambo](https://github.com/kambo)

---

Top Contributors

[![kambo-1st](https://avatars.githubusercontent.com/u/6493048?v=4)](https://github.com/kambo-1st "kambo-1st (2 commits)")

---

Tags

bundlerwebassemblywasmphpxbuild-tools

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/syntaxx-phpx-build-tools/health.svg)

```
[![Health](https://phpackages.com/badges/syntaxx-phpx-build-tools/health.svg)](https://phpackages.com/packages/syntaxx-phpx-build-tools)
```

###  Alternatives

[extism/extism

Make your software programmable. Run WebAssembly extensions in your app using the first off-the-shelf, universal plug-in system.

303.0k1](/packages/extism-extism)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
