42 lines
1.2 KiB
PHP
42 lines
1.2 KiB
PHP
<?php
|
|
|
|
require_once __DIR__ . '/../vendor/autoload.php';
|
|
|
|
// Bootstrap Environment configurations
|
|
if (file_exists(__DIR__ . '/../.env')) {
|
|
$dotenv = Dotenv\Dotenv::createImmutable(__DIR__ . '/..');
|
|
$dotenv->load();
|
|
}
|
|
|
|
use App\Core\Container;
|
|
use App\Core\App;
|
|
use App\Services\Database\Connection;
|
|
use App\Services\Auth\AuthService;
|
|
use App\Services\Auth\RBAC;
|
|
use App\Services\Database\ActivityLogger;
|
|
use App\Middleware\CsrfProtection;
|
|
use App\Middleware\RateLimit;
|
|
use App\Middleware\SecurityHeaders;
|
|
use App\Middleware\Authenticate;
|
|
|
|
$container = new Container();
|
|
|
|
// Database Core configurations
|
|
$container->singleton(Connection::class, Connection::class);
|
|
|
|
// Services bindings
|
|
$container->singleton(AuthService::class, AuthService::class);
|
|
$container->singleton(RBAC::class, RBAC::class);
|
|
$container->singleton(ActivityLogger::class, ActivityLogger::class);
|
|
|
|
// Middleware bindings
|
|
$container->bind(CsrfProtection::class, CsrfProtection::class);
|
|
$container->bind(RateLimit::class, RateLimit::class);
|
|
$container->bind(SecurityHeaders::class, SecurityHeaders::class);
|
|
$container->bind(Authenticate::class, Authenticate::class);
|
|
|
|
// Instantiate App
|
|
$app = new App($container);
|
|
|
|
return $app;
|