symfony-bundles/json-request-bundle
Symfony bundle that decodes JSON request bodies and injects them into the Request parameter bag for easy controller handling. Supports common content types, validation-friendly input, and simplifies building JSON APIs by treating JSON like standard form data.
json_decode(), custom middleware) when the package offers a lightweight, maintained solution.json_decode() calls).Request facade or dedicated packages like spatie/array-to-object).For Executives: "This package lets us ship JSON APIs faster by handling the tedious work of parsing, validating, and formatting requests—reducing dev time by 30%+ on API-heavy features. It’s a low-risk, MIT-licensed solution that aligns with our API-first roadmap, ensuring consistency and security without custom code. Think of it as ‘middleware for JSON,’ saving costs on reinventing the wheel."
For Engineering:
*"The JsonRequestBundle standardizes how we process JSON payloads in Laravel, cutting down on repetitive json_decode() and manual validation. Key benefits:
Request facade for flexibility."*For Developers:
*"No more writing json_decode(file_get_contents('php://input')) every time. This bundle:
// Before: Manual parsing + validation
$data = json_decode(file_get_contents('php://input'), true);
if (!$data['email']) throw new \Exception('Email required');
// After: Bundle handles it
public function store(Request $request) {
$data = $request->json(); // Auto-parsed!
// Validation errors auto-returned as JSON
}
*Pro Tip*: Pair with Laravel’s Form Request validation for stricter rules."*
How can I help you explore Laravel packages today?