Inroute compilation tool for the command line.
The inroute console component should be installed as a development dependency. To execute a compiled router however the inroute runtime must be avaliable. That leaves us with a two step installation process:
composer require inroutephp/inroute
composer require --dev inroutephp/console
By default the build configuration is read from a file named inroute.json
in
the current working directory. A simple configuration file can look like:
{
"source-dir": "src/Controller",
"source-prefix": "MyApp\\Controller",
"target-filename": "src/HttpRouter.php",
"target-namespace": "MyApp",
"target-classname": "HttpRouter"
}
The following is a list of possible configuration values:
Path to project autoloader. Defaults to vendor/autoload.php
.
The classname of a compile time container. Only needed if compile time objects have dependencies that needs to be injected.
Classname of compile time bootstrap script. Should normally not be needed.
Directory to scan for annotated routes. Relative to current working dir.
psr-4 namespace prefix to use when scanning directory. Found .php
files are
assumed to contain classes with this namespace prefix.
Array of source classnames, use instead of or togheter with directory scanning.
Array of annotations to ignore during compilation.
Classname of route factory, default should normally be fine.
Classname of compiler, default should normally be fine.
Array of core compiler passes, default should normally be fine.
Array of custom compiler passes.
The code generator to use, default should normally be fine.
Path to router dump destination. If this file exists it will be overwritten.
The namespace of the generated router (defaults to no namespace).
The classname of the generated router (defaults to HttpRouter
).
To build project router simply run
vendor/bin/inroute build
For mor information
vendor/bin/inroute build -h
To view debug information on the generated router run
vendor/bin/inroute debug
For more conprehensive output try
vendor/bin/inroute debug -v