- Can I use friendsofsymfony/rest in a Laravel application?
- No. friendsofsymfony/rest is built on Symfony 2.x HttpFoundation, event dispatcher, kernel, and configuration conventions, and it ships no Laravel service provider, middleware, router integration, or container bindings. It cannot hook into Laravel's request lifecycle, exception handler, or API resource serialization. For a Laravel codebase the architecture fit is effectively zero, and the last release was 2013-10-12, so it also carries unpatched security exposure. Use Laravel's native HTTP layer instead.
- Is friendsofsymfony/rest the same thing as FOSRestBundle?
- friendsofsymfony/rest is the archived, pre-1.0 ancestor of FOSRestBundle, the package most developers mean when they search for FOSRest. The name invites confusion, but the substance does not: this repository is a Symfony 2.x-era helper, not the actively used bundle. If you landed here looking for FOSRestBundle documentation, you are on the wrong package entirely.
- Which Laravel features replace FOSRestBundle's format negotiation and view listeners?
- Accept-header negotiation maps to middleware plus response()->json(), and the view listener and view layer map to API Resources such as JsonResource and ResourceCollection. Body listener and request decoding map to Form Requests with $request->json() and validated payloads, while exception-to-HTTP mapping maps to the exception handler's render and renderable methods. Versioning helpers are typically handled with route prefixes or custom middleware. All of this is table stakes in Laravel's HTTP layer at zero marginal cost.
- Does friendsofsymfony/rest support PHP 8 or modern Laravel versions?
- No. The package targets obsolete PHP and Symfony version constraints, with its last release dated 2013-10-12, long before PHP 7, PHP 8, or modern Composer and PSR alignment. Those stale transitive constraints can conflict with modern dependency resolution and block framework upgrades. It has no compatibility path with any current Laravel release.
- How do I install friendsofsymfony/rest with Composer?
- You should not install it in a new project; the upstream repository is archived and the package is explicitly described as deprecated. In a live Symfony 2.x install the historical install is composer require friendsofsymfony/rest, but modern Composer will often refuse resolution due to stale platform requirements. If you must deal with it, treat it as legacy debt with an owned fork and a migration ticket, not as a fresh install.
- Is friendsofsymfony/rest still maintained?
- No. The repository is archived, the last release was 2013-10-12, and there are roughly 51 stars with zero dependents, meaning no real-world validation, no ecosystem of answers, and no maintainer response path. There is no security patching and no upstream fix route. An archived package with no dependents should be blocked by default in dependency governance.
- How do I do content negotiation for JSON and XML in Laravel?
- Use middleware to inspect the Accept header and set the response format, then return response()->json() or an API Resource for JSON output. If XML is genuinely required, shape it through a dedicated serializer package rather than hand-rolled view listeners. Laravel's response factory already sets correct content types, so no extra view layer is needed. This keeps negotiation explicit and testable at the middleware boundary.
- How do I return consistent JSON error responses in Laravel without FOSRest's exception mapping?
- Centralize rendering in the exception handler using render or renderable callbacks that return a uniform JSON envelope with status, message, and optional error details. Extend that with form request validation failures and a shared error contract so every endpoint returns the same shape. This replaces FOSRest's structured error handling with a native, framework-supported approach. Documenting the contract as a written standard keeps responses consistent across teams.
- What are the alternatives to FOSRestBundle for building REST APIs in Laravel?
- For most Laravel APIs the native stack is the answer: routing, middleware, form requests, API resources, and centralized exception rendering. If you want extra tooling, options include Laravel's own pagination and resource collections, Sanctum or Passport for authentication, and a serializer package only when XML or non-standard formats are required. Treat the FOSRest listener model as reference material for API conventions rather than as a dependency.
- How should I migrate a Symfony 2.x service that depends on friendsofsymfony/rest?
- First confirm whether any application in your portfolio actually depends on it and whether that service is still a live Symfony 2.x system. If so, freeze the dependency, restrict it to trusted input, own the fork, budget for security patching, and open a migration ticket with a cost comparison against carry cost over the remaining service life. If not, remove it and codify a policy blocking archived, zero-dependent, decade-stale packages. The opportunity signal here is replacement and remediation opportunity, not an adoption endorsement.