wobblecode/rest-bundle
A Symfony bundle for building RESTful APIs with structured JSON responses, serialization, pagination, and consistent error handling. It provides reusable helpers and configuration to reduce boilerplate when exposing resources and integrating REST endpoints into Symfony applications.
Read this first: it is a Symfony bundle, not a Laravel package. There is no service provider, facade, publishable config, or config/rest.php. Laravel's HTTP kernel, router, and container are not the Symfony bundle system, so you cannot composer require this into a Laravel app and get behavior. "Day-to-day leverage" here means one of two things: you actually maintain a Symfony codebase, or you are mining the package for its pattern (auto-exposing existing view controllers as JSON/XML endpoints) and reimplementing it in Laravel.
Where to look, in order:
composer.json — Symfony version constraints. Last release Dec 2020 means Symfony 3/4/5 era; expect friction on Symfony 6/7.DependencyInjection/Configuration.php — what is configurable and what services get registered.Resources/config/ — service definitions and any routing file you must import.Minimal steps in a Symfony app:
composer require wobblecode/rest-bundle (check constraints first; you may need a fork or --ignore-platform-reqs).WobbleCodeRestBundle in config/bundles.php (or AppKernel on Symfony 3).config/routes.yaml or routing.yml.Accept: application/json.First use case: one controller action that serves HTML to browsers and JSON to API clients, driven by content negotiation, without writing a parallel API controller. That is the entire pitch — evaluate it against that single scenario before anything else.
If your actual target is Laravel: skip the package and copy the idea. A content-negotiation middleware plus JsonResource plus a respond() helper on a base controller gets you 90% of it in well under 100 lines.
The pattern being sold: your existing controllers already build a view model; the bundle serializes that same model for API consumers and negotiates the format. Integration points to expect are a base controller or trait, a response/format listener, serializer configuration, and routing conventions.
Accept / _format decide HTML vs JSON. This is the lowest-risk adoption path and the one the package is designed for./api. Import the bundle routes with a prefix so browser traffic keeps hitting HTML and API clients hit JSON. Avoids the classic "browser suddenly downloads a JSON file" failure.password fields, and internal flags leak into responses.text/html and application/json for the same route. Format negotiation bugs are invisible in manual browser testing.$request->prefers(['html', 'json'])), JsonResource for shaping, App::abort(406) for unsupported formats, and a respond() helper on a base controller. Symfony equivalent without the bundle: FOSRestBundle + Symfony Serializer, or #[Route(defaults: ['_format' => 'json'])] with $request->getPreferredFormat().composer.json before requiring. Expect symfony/*: ^3|^4|^5 pins that hard-fail on 6/7 — and forking to bump them is your own maintenance burden from day one.Accept, curl sends */* and browsers send text/html,...; you will get HTML where you expected JSON and assume the bundle is broken. Always test with an explicit Accept: application/json.bin/console debug:router immediately after import and diff against the previous output.debug:router, debug:container --tag=..., and reading the listener's getSubscribedEvents tell you when the bundle fires — kernel request vs response vs view. Most "it does nothing" reports are a priority or event-timing issue.friendsofsymfony/rest-bundle is the maintained Symfony equivalent. In Laravel, the idiomatic move is middleware + API Resources, which you control entirely.How can I help you explore Laravel packages today?