I have one route in Laravel (9) which is for photo resizing. In that route max speed is needed, so I want to avoid loading not used controller, models, vendors in that route. Is this possible? How? Maybe there are better decisions?
/public/index.php has this code:
<?php
use IlluminateContractsHttpKernel;
use IlluminateHttpRequest;
define('LARAVEL_START', microtime(true));
if (file_exists($maintenance = __DIR__.'/../storage/framework/maintenance.php')) {
require $maintenance;
}
require __DIR__.'/../vendor/autoload.php';
$app = require_once __DIR__.'/../bootstrap/app.php';
$kernel = $app->make(Kernel::class);
$response = $kernel->handle(
$request = Request::capture()
)->send();
$kernel->terminate($request, $response);
Maybe I can load Image Magick vendor and skip the rest? I’m not using Database in that route or anything else which needs dependences