1. Go to this page and download the library: Download jenssegers/lean 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/ */
jenssegers / lean example snippets
use League\Container\ServiceProvider\AbstractServiceProvider;
class SomeServiceProvider extends AbstractServiceProvider
{
/**
* The provided array is a way to let the container
* know that a service is provided by this service
* provider. Every service that is registered via
* this service provider must have an alias added
* to this array or it will be ignored.
*/
protected $provides = [
SomeInterface::class,
];
/**
* This is where the magic happens, within the method you can
* access the container and register or retrieve anything
* that you need to, but remember, every alias registered
* within this method must be declared in the `$provides` array.
*/
public function register()
{
$this->getContainer()
->add(SomeInterface::class, SomeImplementation::class);
}
}
$app = new \Jenssegers\Lean\App();
$app->getContainer()->addServiceProvider(\Acme\ServiceProvider\SomeServiceProvider::class);
$app = new \Jenssegers\Lean\App();
$app->getContainer()->get('settings')['displayErrorDetails'] = true;
$app = new \Jenssegers\Lean\App();
$app->getContainer()->get(\Slim\Settings::class)->set('displayErrorDetails', true);