Required Environment
Reflex requires at least PHP 8.2.0 to run and the
Fusion PHP package manager
to be built as a dependency package into your project. If you plan to
measure code coverage, ensure the optional xdebug extension is available
and configured.
Note
Code coverage must be explicitly enabled by setting xdebug.mode=coverage
in php.ini or an xdebug.ini (file name suffix) configuration file.
Shared Metadata Structure
Since tests are scoped to development and shared across all development
machines, the fusion.dev.php file is where you add and extend Reflex as a
dependency. Create this file in the root directory of your project if it
does not exist, and add the following content:
return [
"structure" => [
"/configs/reflex.php" => ":valvoid/reflex/config",
"/dependencies" => "valvoid.com/valvoid/reflex/1.0.0"
]
];
The development metadata now describes the following project structure, whether the directories and files already exist or not:
configs: Dir for all project configsreflex.php: Reflex config file you map
dependencies: Packages your project depends onfusion.dev.php
For multiple files, you could map a directory instead:
"/configs/reflex" => ":valvoid/reflex/config"
configs/reflex: Mapped dirdev.php: Configlocal.php: Config
Note
The structure described in fusion.dev.php is just an example. You can use
any names you like, since Fusion supports custom structures. For example,
dependencies could be named packages.
Now, you can run the build command from any directory of your project:
fusion build
Once done, the project structure contains the following notable files:
dependencies/valvoid/reflex: Built Reflex packagestate/extensions.php: Mapped configreflex: CLI file
For configuration, Reflex uses Fusion's built-in extension logic. It exposes a
virtual config path in its own structure (visible in metadata), allowing
you to map custom project file or directory containing multiple files. In
this example, the generated extensions.php file contains the following
mapped single-file configuration:
"/config" => [
// index 3 represents your project's position in the graph
// the value may differ depending on how the dependency graph is resolved
3 => dirname(__DIR__, 4) . "/configs/reflex.php",
]
For interaction, Reflex provides the reflex CLI file. Verify the installation
by checking the version:
php dependencies/valvoid/reflex/reflex -v
Custom CLI File
To shorten the previous command, you can create a custom CLI entry
point for Reflex. For example, create a file named reflex in your project
root with the following content:
require __DIR__ . "/dependencies/valvoid/reflex/reflex";
This allows you to interact with Reflex without referencing the dependency path directly:
php reflex -v