pecl-purifier full guide
Detailed setup, dependency management, build commands, and troubleshooting. Start with the overview for the initial commands; use the sections below for the complete setup and behavior. pecl-purifier is classified at maturity tier 4 (see tier assessment for details).
Contents
- Setup and activation
- Version compatibility
- Development loop
- Using locked dependencies
- Nix builds
- Project projections
- Supported scope
Setup and activation
Use the overview’s Quickstart for the initial command sequence. The setup details below apply to that workflow.
The shell supplies PHP and PECL wrappers. PECL’s native resolver selects the source packages; Nix compiles their modules and development headers for the pinned PHP SDK. PHP loads those readonly modules while your application remains in its working tree.
Without a lockfile, each wrapper warns and runs its ordinary, impure tool. A
stale or invalid lock fails. Commit pecl-purifier.lock.json; refresh selection
with pecl-purifier lock --update. Application source edits do not require
relocking. The wrappers can also be installed through your normal Nix setup.
Version compatibility
| Tool or language | Packaged defaults | Tested versions |
|---|---|---|
| PEAR/PECL | 1.10.18 | — |
| GCC (extension compiler) | 16.2.0 | — |
| PHP | 8.5.12 | — |
Operating systems and architectures
| OS | CPU architecture | Packaged toolchain | Recorded workflow |
|---|---|---|---|
| Linux | ARM64 | Yes | Not recorded |
| Linux | x86-64 | Yes | Tested |
Development loop
For a source extension with package.xml, its native dependency declarations
select the packages:
pecl-purifier lock
pecl install --force package.xml
php test.php
The native PECL installer builds your extension outside the Nix sandbox into a
private .pecl-purifier/ directory. PHP loads it alongside the prepared Nix
modules. Rebuild it with the same install command after changing C source.
Changes to package.xml require relocking.
Using locked dependencies
Native tools
pecl list
pecl info yaml
php --ri yaml
php --rf yaml_parse
pecl-purifier exec -- your-command
PECL uses a private native registry and cached source archives. Locked package installation registers the prepared dependency; it does not rebuild that dependency in the working tree. PHP’s native reflection sees the loaded modules, and their development headers remain available from Nix.
The companion records exact archive URLs and hashes, native package metadata and dependency edges, tracked inputs, PHP’s module API, Zend APIs, thread/debug mode and SDK-provided modules. The build checks the actual SDK and archive metadata again. Missing packages fail before network access.
Use lock --input path for additional selection inputs. prefetch prepares
dependencies. Use --project and --lock for an external companion; native
commands accept PECL_PURIFIER_PROJECT and PECL_PURIFIER_LOCK. Environment
profiles retain the modules, headers and wrapper SDK as Nix garbage collector
roots.
Nix builds
An optional project definition can use the overlay’s named builder:
pkgs.pecl-purifier.buildPeclProject {
src = ./.;
doCheck = true;
checkCommand = "php test.php";
}
It exposes evaluation-known packages, tests, release and fetches.
packages.environment contains the prepared modules and manifest;
packages.project builds the extension or packages application source.
extensionOverrides supplies package-specific build changes.
Project projections
This integration provides native release artifacts, rather than a typed cross-purifier project projection interface. The publication workflow below uses those native artifacts.
pecl-purifier bundle
pecl-purifier publish --tag v0.1.0
An extension project produces a reproducible native PECL .tgz, consumed by the
ordinary PECL toolchain. A PHP application without package.xml produces a
source tarball. publish uploads the exact files to an existing GitHub release;
it does not submit a release to the PECL registry.
Supported scope
This version supports PHP 8.5 and PECL source extensions on Linux. Nixpkgs extension recipes supply build prerequisites; newer upstream versions can need recipe overrides. Userland PEAR packages, custom channels and PIE are outside the current scope. PHP configuration that replaces extension search paths is rejected in a locked session.
Target systems
- x86_64-linux
- aarch64-linux