1. Go to this page and download the library: Download cadre/module library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
cadre / module example snippets
$loader = new ModuleLoader([
FirstModule::class,
SecondModule::class,
], 'development', 'web');
$builder = new ContainerBuilder();
$di = $builder->newConfiguredInstance([$loader]);
$obj = $di->newInstance(ClassFromThirdModule::class);
use Aura\Di\Container;
use Cadre\Module\Module;
class FirstModule extends Module
{
public function eb context
return [ThirdModule::class];
} else {
return [];
}
}
public function define(Container $di)
{
$di->params[ClassFromFirstModule::class]['foo'] = 'bar';
}
}
public function define(Container $di)
{
if ($this->loader()->loaded(OtherModule::class)) {
$di->set('service', $di->lazyNew(OtherService::class);
} else {
$di->set('service', $di->lazyNew(DefaultService::class);
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.