dbp/relay-template-bundle
Symfony bundle template for creating new Digital Blueprint relay bundles. Provides a starting structure, config, and CI setup for building relay integrations. Intended as a scaffold and typically not used directly in production projects.
RelayBundle and core-bundle services. Non-Relay projects would need to strip or mock these dependencies, risking broken functionality.spatie/laravel-api-resources).composer.json (e.g., symfony/http-kernel vs. illuminate/container).[ApiResource]) are Laravel-compatible, but Relay-specific attributes (e.g., @Relay\Message) would need replacement.WebTestCase; Laravel uses HttpTests or Pest. Migration would need test suite rewrites.Strategic Alignment:
spatie/laravel-api-resources) achieve the same goals with lower risk?Architectural Trade-offs:
Migration Path:
laravel-api-resources, open-api generators)?Performance and Scaling:
Team and Tooling:
Illuminate\Routing.EventDispatcher vs. Laravel’s Events/Listeners.RelayServiceInterface).ApiResource with a Laravel Resource trait.Assess Use Case:
spatie/laravel-api-resources (for DTOs).#[ApiResponse]).Step-by-Step Integration (Hybrid Approach):
relay module in Laravel’s app/ directory.composer require to install the bundle only in the module.composer require dbp/relay-template-bundle --working-dir=app/relay
// app/Providers/RelayServiceProvider.php
public function register()
{
$this->app->singleton(RelayService::class, function () {
return new RelayService(new SymfonyContainerAdapter());
});
}
Route::prefix('api/relay')->group(function () {
Relay::boot(); // Hypothetical Relay initializer
// Use Symfony routes via a facade or proxy.
});
public function testRelayEndpoint()
{
$response = $this->get('/api/relay/users');
$response->assertStatus(200);
}
Fallback: Fork and Adapt
ApiPlatform\Metadata\ApiResource with a Laravel-compatible trait.EventDispatcher for Laravel’s Events.RelayBundle dependencies or mock them./laravel-relay-template
├── src/Traits/LaravelApiResource.php
├── src/Service/RelayAdapter.php
└── composer.json (with Laravel dependencies)
| Component | Relay Template Bundle | Laravel Native | Integration Strategy |
|---|---|---|---|
| API Resource Templates | ✅ (API Platform 4.x) | ❌ | Use spatie/laravel-api-resources |
| PHP Attributes | ✅ (PHP 8.0+) | ✅ (Laravel 9+) | Native support; adapt Relay-specific attributes |
| Doctrine ORM | ✅ | ❌ (Eloquent) | Use doctrine/dbal or stick with Eloquent |
| Symfony Event System | ✅ | ❌ | Use Laravel’s Events or Bus |
| REST Controllers | ✅ (Symfony-style) | ✅ (Laravel Controllers) | Adapt routes; use middleware for Relay delegation |
| PHPStan/PHPUnit | ✅ (v2/v11) | ✅ (Laravel supports both) | No conflict; configure Laravel’s PHPUnit |
| Service Container | ✅ (Symfony DI) | ✅ (Laravel Container) | Create adapters or use Laravel’s bind() |
Prototype a Relay-Laravel Bridge:
/api/relay/health).**Incremental Pattern Adoption
How can I help you explore Laravel packages today?