Configures ICanBoogie automatically.
Warning
This is an internal ICanBoogie package and is not meant to be used separately.
Autoconfig is a Composer plugin. On post-autoload-dump, it collects the extra.icanboogie section of
the composer.json of every installed package (and of the root package) and writes the result to
vendor/icanboogie/autoconfig.php, which returns an Autoconfig instance.
Packages configure Autoconfig in the extra.icanboogie section of their composer.json. The section is
validated against src/schema.json.
| Option | Description |
|---|---|
config-path |
A path to add to the config locations. |
config-weight |
The weight of the config paths. Defaults to -100 (framework). |
config-constructor |
A map of config names to config builder classes. |
locale-path |
A path, or list of paths, to add to the locale message locations. |
autoconfig-filters |
A callback, or list of callbacks, to alter the Autoconfig once generated. |
autoboot |
A callable, or list of callables, invoked with the application when it boots. |
app-path, app-paths |
The root directory, and hierarchical paths, of the application. |
{
"extra": {
"icanboogie": {
"config-path": "config",
"locale-path": "locale",
"autoboot": "Acme\\MyPackage\\Boot::boot"
}
}
}autoboot lets a package set itself up when Application::boot() runs, without the application having to
know about it. Each value is a static Vendor\Class::method string:
namespace Acme\MyPackage;
use ICanBoogie\Application;
final class Boot
{
public static function boot(Application $app): void
{
// Wire the package into the application
}
}- Callables are invoked with the
Applicationafter it is constructed (config, container, and events are available) and beforeBootEventis emitted. Return values are ignored and exceptions propagate. - They are exposed as
Autoconfig::$boot_callables, in dependency order, and in declaration order within a package. - Values that don't match the
Vendor\Class::methodform make the dump fail with anInvalidArgumentException. - To override them, use an
autoconfig-filterscallback returning$autoconfig->with(['boot_callables' => [...]]).
Use BootEvent instead for application code reacting to a booted application. See
ADR 0001 for the rationale.
The project is continuously tested by GitHub actions.
This project adheres to a Contributor Code of Conduct. By participating in this project and its community, you're expected to uphold this code.
See CONTRIBUTING for details.