Core component of the eArc framework. The eArc stands for explicit architecture. It is about the urge to make code as easy to comprehend as possible, and the striving to touch the programmers' freedom to code as little as possible. In short, it is about simplicity and good architecture.
earc/core handles aspects all earc components have in common. Users of the framework or some of its components will never need to install this package directly.
Place a file named .earc-config.php
beneath the vendor dir. It's the configuration
file for all the earc components.
<?php #.earc-config.php
return ['earc' => [
'is_production_environment' => true
//.. place here the parameters for the components
]];
Then put the following code in the bootstrap section of your framework or your
index.php
file.
use eArc\DI\DI;
use eArc\Core\Configuration;
DI::init();
Configuration::build();
That's it. You're ready to go.
If you want to put the configuration file somewhere else you can pass the filename
as parameter to the build
method.
Hint: If you prefer the YAML format and do not use php constructs in your configuration, you can use a yaml parser.
If you get an error
PHP Fatal error: Uncaught Error: Class 'eArc\DI\DI' not found
you most probably have not registered the composer autoloader yet. You can do this by requiring the composer autoload script in the vendor directory.
use eArc\DI\DI;
use eArc\Core\Configuration;
require '/absolute/path/to/your/vendor'.'/autoload.php';
DI::init();
Configuration::build();
All components can be used without the framework. Some components may depend on each other.
- (advanced) dependency injection: earc/di
- (lucid) event handling: earc/event-tree
- (lucid) persistence abstraction layer: earc/data
- (explicit) routing: earc/router
- (reduced) parameter transformation: earc/parameter-transformer
- (reduced) object/array casting: earc/cast
- PHP ^7.2 || ^8.0
- complete rewrite
- the first official release