Application
Antares\Application is the entry point for every Antares app. It exposes a fluent API for wiring up providers, middleware, and the route layer before calling run().
Application::create(string $basePath): selfCreates the application instance. $basePath should be the root of your project (the directory that contains composer.json, .env, and storage/).
->providers(array $providers): staticRegisters service providers. These run before route providers and are used for container bindings and singletons.
->routeProviders(array $providers): staticRegisters route providers. These are responsible for calling $router->register() with your controller classes.
->middleware(array $middleware): staticRegisters global middleware. Middleware runs in order on every request, wrapping the Dispatcher as the innermost layer.
->run(): voidBoots the application, creates a PSR-7 ServerRequest from PHP globals, runs the pipeline, and emits the response.
Full Example
Section titled “Full Example”Application::create(__DIR__ . '/..') ->providers([ AppServiceProvider::class, DatabaseServiceProvider::class, ]) ->routeProviders([ RouteServiceProvider::class, ]) ->middleware([ CorsMiddleware::class, AuthMiddleware::class, LogMiddleware::class, ]) ->run();Testing
Section titled “Testing”Use boot() + handle() to test without emitting output:
$app = Application::create(__DIR__ . '/..') ->providers([AppServiceProvider::class]) ->routeProviders([RouteServiceProvider::class]);
$app->boot();
$request = (new Psr17Factory())->createServerRequest('GET', '/users');$response = $app->handle($request);
assert($response->getStatusCode() === 200);