Skip to content

Latest commit

 

History

History
49 lines (38 loc) · 1.69 KB

23.build.md

File metadata and controls

49 lines (38 loc) · 1.69 KB

Build

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.

Configuration

The configuration file is a build.yaml file

name: app
entry: ./src/main.php
libraries: ./src/lib
environment: ./env.yaml
match: /(^\.\/(\.build-cache|src|vendor|resources|bin)\/.*)|(\.\/env\.yaml)|(\.\/env\.yaml)/
  • 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 your main 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, usually env.yaml.
    This is the same file that you usually pass in when you run composer dev:start -- --environment="env.yaml".
    This environment file is not required and can be overwritten at runtime by simply passing in the option
    php app.phar --environment="./my-env.yaml"
  • match a regular expression matching all other files you want bundled in your .phar file.

Optimize

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.