requestum/api-bundle
Requestum API Bundle is a Symfony package that helps structure JSON APIs with reusable base controllers, response helpers, and sensible conventions for faster endpoint development.
Before installing anything, note the mismatch: requestum/api-bundle is a Symfony bundle, not a Laravel package. There is no ServiceProvider, no config/api.php, and no extra.laravel block in its composer.json, so Composer will install it but Laravel will never boot it. The first practical step for a Laravel developer is therefore not composer require but reading the source to decide whether the concepts are worth porting.
Where to look first:
src/ for the bundle's base controller, response/exception classes, and any request/response transformer logic — these carry the actual "core api functionality."src/DependencyInjection/ and Resources/config/services.yaml (or XML) — this is what would have been auto-wired by Symfony's Kernel, and is where you discover what the bundle actually provides.composer.json for php / Symfony version constraints — the 2021-01-26 release pins you to an older ecosystem.Your first real use case in a Laravel app is to reimplement the two or three useful ideas — typically a consistent JSON response envelope, a base API controller, and centralized exception-to-JSON handling — using Laravel's native primitives rather than trying to force the bundle in. Treat the repo as a reference implementation, not a dependency.
Response envelope, ported to Laravel. If the bundle centralizes an API response shape (e.g. { data, meta, errors }), replicate it with a JsonResource or a small ApiResponse helper:
class ApiResponse
{
public static function ok(mixed $data, array $meta = []): JsonResponse
{
return response()->json(['data' => $data, 'meta' => $meta, 'errors' => []]);
}
public static function error(string $message, int $status = 400, array $details = []): JsonResponse
{
return response()->json(['data' => null, 'errors' => [['message' => $message, 'details' => $details]]], $status);
}
}
Centralized error handling. The bundle's exception listener maps to Laravel's App\Exceptions\Handler::render() (or register() in Laravel 11). Mirror whatever exception-to-status mapping it defines:
public function register(): void
{
$this->renderable(function (ValidationException $e, $request) {
if ($request->is('api/*')) {
return ApiResponse::error('Validation failed', 422, $e->errors());
}
});
}
Base controller conventions. If the bundle ships a base class providing helpers like respond(), respondCreated(), respondNoContent(), extract those into a app/Http/Controllers/ApiController.php that your API controllers extend. Use FormRequest for input validation and JsonResource for output shaping — Laravel's equivalents of the transformers the bundle likely provides.
Integration tip. If you genuinely want to reuse the bundle's PHP classes (response DTOs, value objects) that have no Symfony container dependency, you can often pull in only those files by copying them into app/Support/ or via a classmap autoload entry. Anything touching Symfony\Component\DependencyInjection, EventDispatcher, or HttpKernel is not portable — drop it.
Kernel::registerBundles(). You cannot "just install it."php constraint that may block current Laravel 10/11 installs, and expect no fixes for PHP 8.1+ deprecations.kernel.event_listener, controller.service_arguments). Even copy-pasted classes may fail because they type-hint Symfony interfaces that Laravel doesn't bind.config/packages/*.yaml and is processed by the bundle's Extension/Configuration classes. There is no php artisan vendor:publish equivalent, and no config merging into Laravel's config repository.vendor/requestum/api-bundle/src/ and the tests/ folder (if present) as the source of truth for expected request/response shapes rather than relying on any README.spatie/laravel-responsecache / spatie/laravel-query-builder / dingo/api alternatives instead.How can I help you explore Laravel packages today?