Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Api Bundle Laravel Package

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.

View on GitHub
Deep Wiki
Context7

Getting Started

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:

  1. src/ for the bundle's base controller, response/exception classes, and any request/response transformer logic — these carry the actual "core api functionality."
  2. 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.
  3. 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.

Implementation Patterns

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.

Gotchas and Tips

  • It will not boot in Laravel. There is no Laravel integration; the bundle only registers via Symfony's Kernel::registerBundles(). You cannot "just install it."
  • Stale release. Last tagged release was 2021-01-26. Expect a php constraint that may block current Laravel 10/11 installs, and expect no fixes for PHP 8.1+ deprecations.
  • Tiny surface area. 4 stars, 0 dependents means almost no community answers, no Stack Overflow coverage, and no third-party tutorials. Debugging means reading the source directly — there is no external documentation to lean on.
  • Symfony DI assumptions. The bundle's services assume Symfony's autowiring and tag system (kernel.event_listener, controller.service_arguments). Even copy-pasted classes may fail because they type-hint Symfony interfaces that Laravel doesn't bind.
  • Extension points are Symfony-specific. Bundle configuration lives in 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.
  • Debugging strategy. If you must trace behavior, use 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.
  • When to skip entirely. Given the score, age, and Symfony-only nature, the pragmatic recommendation for a Laravel codebase is to borrow patterns (response envelope, exception mapping) and never add the dependency. If you need a maintained Laravel API toolkit, reach for spatie/laravel-responsecache / spatie/laravel-query-builder / dingo/api alternatives instead.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
novasa/laravel-language-center
opencage/geocode
adolfoholzer/parameters
livenetworks/ln-starter
shitoudev/permissionmanager
johannesclimacus/laravel-tui
hocvt/seotools
vitalybaev/sypexgeo
amphibee/themosis-ignition
gito-me/fast-excel
frankyso/laravel-ipaymu
geolize-studio/laravel-chile
boomerangui/chat
cgv/localized-resource
noith/settings
kda/laravel-package
kda/filament-dynamic-navigation
bypersoft/signbox
pairus/product-data
fayne/laravel-filament-cms-core