ac/web-services-bundle
Symfony bundle providing generic REST API workflow tools: request lifecycle events, JMS-based deserialization into existing objects, validation error handling, configurable response formats (JSON/XML/JSONP/YML), and per-path settings for exceptions, response data, JSONP, and headers.
FormRequest validation).laravel/api, spatie/array-to-object, nesbot/carbon for serialization/validation).AppKernel.php) is deprecated in Laravel (since v5.4+), requiring workarounds or custom bootstrapping.AppKernel with register() in a custom service provider).symfony/serializer.Illuminate\Events\Dispatcher vs. Symfony’s EventDispatcher).App\Services).laravel/api for REST, spatie/laravel-query-builder for filtering, fruitcake/laravel-cors for CORS).AppKernel, manual service registration).laravel/api or FOSRestBundle?spatie/array-to-object + custom middleware may suffice.Request->validate() but more flexible).422 Unprocessable Entity with validation details).routes/web.php/api.php, while this bundle assumes Symfony’s routing component.$router->middleware()) differs from Symfony’s event listeners.bind()/singleton() vs. Symfony’s set()/get().laravel/api for REST, spatie/laravel-query-builder for filtering).ACWebServicesBundle's serializer with a Laravel service provider using spatie/array-to-object.AppKernel registration with a service provider.symfony/event-dispatcher).Request/Response with Laravel’s Illuminate\Http\Request.| Feature | Laravel Native | ACWebServicesBundle | Workaround |
|---|---|---|---|
| Request Deserialization | Manual (or spatie/array-to-object) |
JMS Serializer | Custom service provider with JMS or spatie |
| Event-Driven Workflows | Laravel Events | Symfony Events | Use Laravel’s Event facade |
| Validation Errors | FormRequest |
Custom error mapping | Extend Illuminate\Validation\Validator |
| Response Formats | Response::json() |
XML/JSONP/YML | Middleware for format negotiation |
| Routing | Laravel Router | Symfony Router | Use Laravel routes + custom middleware |
composer require ac/web-services-bundle --dev
// app/Providers/ACWebServicesProvider.php
namespace App\Providers;
use AC\WebServicesBundle\ACWebServicesBundle;
class ACWebServicesProvider extends \Illuminate\Support\ServiceProvider {
public function register() {
$bundle = new ACWebServicesBundle();
$bundle->register(); // Adapt to Laravel's container
}
}
// app/Http/Kernel.php
protected $middleware = [
\App\Http\Middleware\ACWebServicesMiddleware::class,
];
laravel/api) ready.laravel-debugbar).How can I help you explore Laravel packages today?