1. Go to this page and download the library: Download dakujem/slim-factory 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/ */
class MiddlewareDecorator implements AppDecoratorInterface
{
public function decorate(App $slim): void
{
$slim->addRoutingMiddleware();
$slim->addBodyParsingMiddleware();
$slim->addErrorMiddleware();
}
}
// The following 4 decorators are equivalent:
$decorators = [
new MiddlewareDecorator(), // a decorator instance
MiddlewareDecorator::class, // a class name
fn() => new MiddlewareDecorator(), // a decorator provider
function(App $slim): void { // a callable decorator
$slim->addRoutingMiddleware();
$slim->addBodyParsingMiddleware();
$slim->addErrorMiddleware();
}
];
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.