A Laravel PHAR bundler designed specifically for NativePHP applications. Parcel provides specialized tools for packaging Laravel applications into PHAR files with proper path handling and NativePHP-specific optimizations.
Install Parcel globally via Composer:
composer global require nativephp/parcelMake sure your global Composer bin directory is in your PATH.
Navigate to your Laravel project and run:
parcel prepare
parcel compileparcel prepareThis combines both preparation steps:
- Pushes NativePHP-specific stub files to your project
- Patches composer.json for PHAR compatibility
- Creates optimized Box configuration
If you prefer to run steps individually:
# Push stub files and configuration
parcel push-stubs
# Patch composer.json
parcel patch-composerparcel compileThis will:
- Use Box to compile your Laravel project into a PHAR
- Apply NativePHP path fixes automatically
- Create an optimized bundle in the
build/directory
- RealPathMod Compactor: Automatically fixes
realpath()calls for PHAR compatibility - NativePHP Path Helper: Cross-platform path normalization with
nativephp_rp()function - PHAR Router: Web server routing for Laravel applications running from PHAR
- Optimized Configuration: Pre-configured Box settings for Laravel applications
- PHP 8.2+
- Composer
- humbug/box (automatically handled)
Prepares a Laravel project for PHAR compilation by running both push-stubs and patch-composer.
Arguments:
target-dir- Target Laravel project directory (default: current directory)
Options:
--force, -f- Overwrite existing files
Pushes NativePHP stubs and configuration to a Laravel project.
Arguments:
target-dir- Target Laravel project directory (default: current directory)
Options:
--force, -f- Overwrite existing files
Patches composer.json for NativePHP PHAR compilation.
Arguments:
target-dir- Target Laravel project directory (default: current directory)
Compiles a Laravel project into a PHAR using Box.
Arguments:
working-dir- Working directory for compilation (default: current directory)
Options:
--config, -c- Path to box.json configuration file--debug- Enable debug output
See CONTRIBUTING.md. Please report security issues as described in SECURITY.md, not in public issues.
Parcel is open-source software licensed under the MIT license.