Search by

nativephp / parcel

simonhamp

Laravel PHAR bundler for NativePHP applications with cross-platform path handling and optimization features

Package info

github.com/NativePHP/parcel

pkg:composer/nativephp/parcel

Fund package maintenance!

nativephp

Open Collective

Statistics

Installs: 7

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 1

1.0.1 2026-11-20 01:42 UTC

This package is auto-updated.

Last update: 2026-11-20 01:42:59 UTC


README

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.

Installation

Install Parcel globally via Composer:

composer global require nativephp/parcel

Make sure your global Composer bin directory is in your PATH.

Usage

Quick Start

Navigate to your Laravel project and run:

parcel prepare
parcel compile

Individual Commands

1. Prepare Project (Recommended)

parcel prepare

This combines both preparation steps:

  • Pushes NativePHP-specific stub files to your project
  • Patches composer.json for PHAR compatibility
  • Creates optimized Box configuration

2. Manual Steps (Optional)

If you prefer to run steps individually:

# Push stub files and configuration
parcel push-stubs

# Patch composer.json
parcel patch-composer

3. Compile PHAR

parcel compile

This will:

  • Use Box to compile your Laravel project into a PHAR
  • Apply NativePHP path fixes automatically
  • Create an optimized bundle in the build/ directory

Features

  • 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

Requirements

  • PHP 8.2+
  • Composer
  • humbug/box (automatically handled)

Commands

parcel prepare [target-dir]

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

parcel push-stubs [target-dir]

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

parcel patch-composer [target-dir]

Patches composer.json for NativePHP PHAR compilation.

Arguments:

  • target-dir - Target Laravel project directory (default: current directory)

parcel compile [working-dir]

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

Contributing

See CONTRIBUTING.md. Please report security issues as described in SECURITY.md, not in public issues.

License

Parcel is open-source software licensed under the MIT license.