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
Laravel Api Problem

Laravel Api Problem Laravel Package

api-skeletons/laravel-api-problem

Laravel API Problem provides RFC 7807-compliant problem details responses for JSON APIs, helping you return consistent, machine-readable errors with exception and validation support. It integrates with Laravel to standardize API error payloads and status codes.

View on GitHub
Deep Wiki
Context7

Problem Details for HTTP APIs for Laravel

Frequently asked questions about Laravel Api Problem
How do I install api-skeletons/laravel-api-problem?
Install it with Composer by requiring api-skeletons/laravel-api-problem, targeting ^2.0.1 only after confirming PHP and Laravel compatibility. Then wire it into Laravel's exception handling and rendering so API errors are returned as application/problem+json. Run contract tests against 4xx and 5xx responses to confirm Content-Type, status codes, and body shape. Keep a rollback pin to 2.0.0 in case Composer resolution fails.
Does laravel-api-problem support Laravel 10 and Laravel 11?
The package is built for Laravel API services and integrates with the framework exception handler, but the provided release notes do not list an explicit Laravel version matrix. The 2.0.1 release only bumps instantiator to 2.0, so supported Laravel versions should be confirmed from the package composer.json or support documentation. Install it in staging and exercise exception rendering before relying on it in production.
How do I return RFC 7807 problem details for validation errors in Laravel?
Laravel throws ValidationException for failed form requests and validator calls, and this package is described as providing validation support alongside general exception support. Typically you let the exception handler render those failures as application/problem+json, or map them to a problem type with the relevant invalid-params details. Assert the exact body shape and status code with a contract test rather than assuming field names.
What PHP version does laravel-api-problem 2.0.1 require?
The release notes only state that 2.0.1 bumps instantiator to 2.0, and the PHP floor is not called out in the provided evaluation. Check the composer.json require block for the declared PHP constraint and run composer why instantiator to see whether the major-version bump conflicts with your platform or other dependencies. If your runtime is below the new dependency floor, pin 2.0.0 or upgrade PHP first.
How do I map custom domain exceptions to problem detail responses?
Map each domain exception to an RFC 7807 problem type in Laravel's exception rendering configuration or in a dedicated renderer or middleware layer. Keep the mapping explicit so status codes, type URIs, titles, and detail fields stay consistent across teams and endpoints. Document the exception-to-problem mappings and cover them with contract tests to avoid inconsistent payloads.
Is laravel-api-problem compatible with instantiator 2.0?
Version 2.0.1 of the package is the release that moves to instantiator 2.0, so the package itself expects that major version. The risk is at the Composer and platform level, because instantiator 2.0 may raise the PHP floor or conflict with transitive dependencies in your application. Confirm resolved versions in staging and watch for hydration or object-construction edge cases if instantiator changed constructor behavior.
How should I test problem details responses in a Laravel API?
Write feature tests that hit endpoints triggering validation errors, authentication failures, and unhandled exceptions, then assert the status code and the application/problem+json Content-Type. Assert the problem body shape, including type, title, status, and detail fields, rather than snapshotting the entire response. Include a test that debug details do not leak under production configuration, and rerun these contract tests after any Composer update.
Does laravel-api-problem replace Laravel's exception handler?
No, it integrates with Laravel's exception handling and rendering so your application still owns logging, monitoring, and handler configuration. The package standardizes the API error payload and status codes rather than replacing application logging. Review duplicate error logging between the package renderer and your application handler, especially for 5xx responses.
What are the alternatives to laravel-api-problem for consistent API errors?
Alternatives include bespoke exception renderers, middleware that formats error payloads, and other RFC 7807 packages. The main trade-off is whether you want a small dedicated response-formatting dependency or a custom error contract you maintain yourself. If multiple teams or clients depend on a stable error contract, a problem-details package can reduce duplicated exception serialization logic.
Is laravel-api-problem production ready and actively maintained?
It is a narrowly scoped response-formatting package, and the 2.0.1 release is a patch that only bumps instantiator to 2.0, so ongoing code maintenance is expected to be low. Production readiness depends on confirming the PHP and Laravel support matrix, pinning an approved version, and testing exception rendering for 4xx and 5xx paths. Plan a short integration spike and keep a rollback pin if Composer conflicts appear.
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.
dbravoan/dbcms-admin-theme-dbcms
dbravoan/dbcms-theme-db-cyber
dbravoan/dbcms-blocks-basic
dbravoan/dbcms-module-content-audit
dbravoan/dbcms-module-ai-assistant
paygate-to/paygate-php
padosoft/askmydocs-connector-base
defstudio/supercharged-carbon
bernskioldmedia/laravel-matomo
bernskioldmedia/laravel-harvest
bernskiold/laravel-data-scrubber
bernskiold/laravel-currency-converter
bernskiold/laravel-campaign-monitor
bernskioldmedia/laravel-autotranslate
siberfx/telegram-bot
roy-sandip/laravel-view-extended
gregsphotography/site-builder-core
roy-sandip/laravel-view
anodyne/blade-fluentui-icons
webx-ui/module-catalog-collections