Scroll to navigation

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

Print a help message and exit.
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.

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.

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.

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

phpabtpl composer.json >autoload.php.tpl
phpabtpl --basedir src composer.json >autoload.php.tpl
phpabtpl --require proj1/pack1 --require-file src/autoload.php

FILES

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:

The Composer package's vendor name (e.g. "vendor" in "vendor/project").
The Composer package's project name (e.g. "project" in "vendor/project").
The corresponding autoloader file (e.g. "Vendor/Project/autoload.php").

It can be installed in /usr/share/pkg-php-tools/autoloaders/package.

2024-03-03 1.45