35 lines
610 B
PHP
35 lines
610 B
PHP
|
|
<?php
|
||
|
|
|
||
|
|
declare(strict_types=1);
|
||
|
|
|
||
|
|
namespace App\Bootstrap;
|
||
|
|
|
||
|
|
use Slim\App;
|
||
|
|
use Slim\Factory\AppFactory;
|
||
|
|
use Slim\Middleware\BodyParsingMiddleware;
|
||
|
|
|
||
|
|
class AppBootstrap
|
||
|
|
{
|
||
|
|
/**
|
||
|
|
* Create and configure Slim App instance
|
||
|
|
*
|
||
|
|
* @return App
|
||
|
|
*/
|
||
|
|
public static function create(): App
|
||
|
|
{
|
||
|
|
$app = AppFactory::create();
|
||
|
|
|
||
|
|
// Add body parsing middleware
|
||
|
|
$app->addBodyParsingMiddleware();
|
||
|
|
|
||
|
|
// Add routing middleware
|
||
|
|
$app->addRoutingMiddleware();
|
||
|
|
|
||
|
|
// Add error middleware
|
||
|
|
$app->addErrorMiddleware(true, true, true);
|
||
|
|
|
||
|
|
return $app;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|