PHPABTPL(1) | pkg-php-tools | PHPABTPL(1) |
NAME¶
phpabtpl - generate phpab templates with dependency autoloading
SYNOPSIS¶
phpabtpl [OPTION...] [composer.json]
DESCRIPTION¶
phpabtpl is a command-line tool used to generate phpab autoloader templates. In addition to the regular autoloading of the package's own class files, the generated template will also include automatic loading of dependencies and statically loaded files, based on the specification read from a composer.json file.
OPTIONS¶
- -h, --help
- Print a help message and exit.
- --basedir directory
- Set the base directory for "files" autoloading.
This option can be used to adjust the paths for statically loaded files (Composer's "files" section), to treat them as relative to the specified directory rather than to the source's root. This would typical be used for packages where the actual source files are kept in a sub-directory (commonly "src").
Limitation: This directory must be somewhere above the to-be-loaded files in the file hierarchy. It will not traverse upwards.
- --require composer_package
- Adds an additional required dependency to be loaded.
composer_package is the name of a Composer package, e.g. "vendor/project". It is treated as an extra entry in the composer.json "require" section.
This option can be repeated to add multiple dependencies.
- --suggest composer_package
- Adds an additional suggested dependency to be (optionally) loaded.
composer_package is the name of a Composer package, e.g. "vendor/project". It is treated as an extra entry in the composer.json "suggest" section.
This option can be repeated to add multiple dependencies.
- --require-file file
- Adds an additional file to be loaded.
The file path will be adapted to --basedir, if given. It is treated as an extra entry in the composer.json "autoload.files" section.
This option can be repeated to add multiple files.
EXAMPLES¶
- Generate a template with dependency autoloading:
- phpabtpl composer.json >autoload.php.tpl
- Generate a template for an autoloader to be placed in the "src" directory:
- phpabtpl --basedir src composer.json >autoload.php.tpl
- Generate a template with manually specified dependencies:
- phpabtpl --require proj1/pack1 --require-file src/autoload.php
FILES¶
- debian/pkg-php-tools-autoloaders
- Autoloaders that are not correctly identified by phpabtpl by
default can be manually specified in this file.
The format is a set of lines, with each line having the following fields:
- vendor_name
- The Composer package's vendor name (e.g. "vendor" in "vendor/project").
- project_name
- The Composer package's project name (e.g. "project" in "vendor/project").
- autoloader_path
- The corresponding autoloader file (e.g. "Vendor/Project/autoload.php").
It can be installed in /usr/share/pkg-php-tools/autoloaders/package.
2024-07-26 | 1.46 |