| Server IP : 65.108.144.40 / Your IP : 216.73.217.165 Web Server : Apache/2.4.52 (Ubuntu) System : Linux ubuntu-8gb-hel1-1 5.15.0-173-generic #183-Ubuntu SMP Fri Mar 6 13:29:34 UTC 2026 x86_64 User : dev ( 1000) PHP Version : 8.2.30 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/html/project-slim/public/ |
Upload File : |
<?php
use Slim\Factory\AppFactory;
use App\Database\Database;
use App\Database\EloquentBootstrap;
use App\Routes\RoutesLoader;
require __DIR__ . '/../vendor/autoload.php';
// Load configuration
$config = require __DIR__ . '/../config/config.php';
// Set up legacy database connection (for backward compatibility)
Database::setConfig($config['database']);
// Initialize Eloquent ORM
EloquentBootstrap::boot($config['database']);
$app = AppFactory::create();
// Add middleware
$app->addBodyParsingMiddleware();
$app->addRoutingMiddleware();
// Add error middleware
$errorMiddleware = $app->addErrorMiddleware(
$config['settings']['displayErrorDetails'],
$config['settings']['logErrors'],
$config['settings']['logErrorDetails']
);
// CORS Middleware (for API access)
$app->add(function ($request, $handler) {
$response = $handler->handle($request);
return $response
->withHeader('Access-Control-Allow-Origin', '*')
->withHeader('Access-Control-Allow-Headers', 'X-Requested-With, Content-Type, Accept, Origin, Authorization')
->withHeader('Access-Control-Allow-Methods', 'GET, POST, PUT, DELETE, PATCH, OPTIONS');
});
// Handle preflight requests
$app->options('/{routes:.+}', function ($request, $response, $args) {
return $response;
});
// Load all routes using the modular route loader
$routesLoader = new RoutesLoader($app);
$routesLoader->loadRoutes();
$app->run();