You can build your whole project into a single .phar
file with
php -dphar.readonly=0 catpaw.phar --build
Note
You can download the latest catpaw.phar program from the releases page.
Note
The -dphar.readonly=0
option is required because the program needs permissions to write the .phar file.
The configuration file is a build.ini file
name = app
entry = src/main.php
libraries = src/lib
environment = env.ini
match = "/(^\.\/(\.build-cache|src|vendor|resources|bin)\/.*)|(\.\/env\.ini)/"
name
is the output name of your bundle.
The program will append .phar to this name if not already specified in the configuration.entry
the entry file of your application.
This is the file that contains yourmain
function.libraries
a list of directories, separated by,
, that contain php services.
These services will be passed up to the dependency injection container.environment
the environment file of your application, usuallyenv.ini
.
This is the same file that you usually pass in when you runcomposer dev:start -- --environment=env.ini
.
This environment file is not required and can be overwritten at runtime by simply passing in the optionphp app.phar --environment=my-env.ini
match
a regular expression matching all other files you want bundled in your .phar file.
You can shake off all your dev dependencies and make the bundle smaller by passing --build-optimize
.
php -dphar.readonly=0 ./catpaw.phar --build --build-optimize
Note
More optimization features may come in the future.