softonic/laravel-request-accept-json-middleware
Laravel middleware that automatically sets the Accept: application/json header on incoming requests, ensuring your API returns JSON responses even when clients omit it. Easy to register globally or per route group, with no changes required to existing controllers or routes.
This release is a hard platform bump: laravel/framework ^12.0 and php ^8.5. Before anything else, confirm your application actually satisfies both — 5.0.0 will not install, and will not run, on Laravel 11 or PHP 8.4 and below.
php -v and composer show laravel/framework. If either falls short, do not attempt the upgrade; pin to the latest 4.x line instead (composer require <vendor>/<package>:"^4.0").UPGRADING.md or the release diff on the repo.composer require <vendor>/<package>:"^5.0" --with-all-dependencies — the --with-all-dependencies flag matters because the Laravel 12 constraint will cascade through your lock file.php artisan vendor:publish --provider="<Vendor>\\<Package>\\<Package>ServiceProvider") and get one existing 4.x call site working end-to-end before touching the rest. That single path surfaces most breaking changes cheaply.If you're on an older stack, the correct action is no action — stay on 4.x. There is no compatibility shim in this release.
Pin the platform, not just the package. Because 5.0.0 hard-requires PHP 8.5, add an explicit platform block to composer.json in CI and local dev so nobody silently resolves a different dependency tree than production:
"config": {
"platform": { "php": "8.5.0" }
}
Stage the upgrade behind a branch and a matrix. Run your test suite against a CI matrix of Laravel 12 / PHP 8.5 only for the 5.x branch, and keep a 4.x maintenance branch on the old matrix until all consumers have migrated. If this package is a dependency of your own package, widen your constraint carefully — "^4.0|^5.0" only if your code genuinely works against both APIs.
Isolate the package behind a thin adapter. If you call this package from many places, wrap the calls you actually use in a small application-level service or facade of your own before upgrading. The migration then becomes a one-file change instead of a grep-and-replace across the codebase, and the next major (6.0) is cheap.
Keep the old lock file as a rollback artifact. Commit composer.lock on the upgrade branch as a separate commit from any code changes, so git revert restores a known-good dependency set without untangling hand-edited code.
Feature-flag the switch in production. Deploy the upgraded code with the new call path disabled, verify boot and container bindings resolve, then enable. Laravel 12's bootstrap and service-provider lifecycle is where version bumps most often bite, and it bites at boot rather than at request time.
composer update will lie to you. If your local PHP is 8.4 but CI is 8.5, Composer resolves different trees locally. Always set config.platform.php (see above) or run the update inside the same container image CI uses.composer why-not laravel/framework ^12.0 is the fastest way to find the culprit.error_reporting(E_ALL) and treat deprecation notices as migration work — they become removals in PHP 8.6/9.php artisan config:clear && php artisan cache:clear && composer dump-autoload. A cached service-provider manifest from 4.x is a classic source of "works locally, fails deployed" after a major bump.How can I help you explore Laravel packages today?