symfony/gatewayapi-notifier
Symfony Notifier bridge for GatewayAPI SMS. Configure via GATEWAYAPI_DSN (token, from) and send SmsMessage with optional GatewayApiOptions (class, callback URL, user ref, labels, etc.) for advanced message settings.
Illuminate\Notifications) and queue workers (Illuminate\Queue) provide functional parity but lack direct GatewayAPI integration. A wrapper layer would be required to abstract Symfony-specific logic (e.g., Transport, Message) into Laravel-compatible interfaces.HttpClient or Guzzle could suffice. However, the package’s pre-built GatewayAPI SDK integration (if present) might offer higher reliability for production-grade APIs.notifier component (v6.0+), which may conflict with Laravel’s composer constraints or pull in unnecessary dependencies.TransportFactory) must be bridged to Laravel’s IoC container, likely via a custom service provider or facade.Event system; mapping listeners would require abstraction layers.Notifier (e.g., GatewayApiNotifier::send(SmsMessage)).Notifier only for GatewayAPI-specific logic, while keeping other notifications in Laravel’s native system.gatewayapi://TOKEN@default?from=FROM) simplifies credential management but requires Laravel to parse and validate DSNs.| Risk | Impact | Mitigation |
|---|---|---|
| Dependency Conflicts | Symfony packages may clash with Laravel’s composer dependencies (e.g., symfony/http-client). |
Use composer require symfony/notifier --ignore-platform-reqs or alias packages in composer.json. |
| Maintenance Burden | Symfony updates may break Laravel integration. | Pin to a stable Symfony version (e.g., ^6.4) and test against Laravel’s LTS. |
| Feature Gaps | Laravel’s native tools may lack GatewayAPI-specific optimizations (e.g., retry logic). | Benchmark Laravel Queues vs. Symfony Messenger for reliability. |
| Testing Complexity | Cross-framework integration increases test surface area. | Use PestPHP for unit tests and Laravel Dusk for integration tests with GatewayAPI mocks. |
| Vendor Lock-in | Tight coupling to Symfony may hinder future portability. | Design interfaces (e.g., GatewayApiNotifierInterface) for easier replacement. |
spatie/laravel-notification-channels-gatewayapi)?
Illuminate\Notifications but lacks native GatewayAPI support. A custom notification channel (e.g., GatewayApiChannel) could bridge this gap.HttpClient or Guzzle could replace it, but the package’s OAuth2 handling and GatewayAPI-specific optimizations may add value.GatewayApiNotifier facade) to test integration.^6.4) to avoid breaking changes.composer require symfony/notifier:^6.4 --ignore-platform-reqs to bypass platform constraints.public function register()
{
$this->app->singleton('symfony.notifier', function ($app) {
return new \Symfony\Component\Notifier\Notifier([
new \Symfony\Component\Notifier\Bridge\GatewayApi\GatewayApiTransport(
new \Symfony\Component\Notifier\Transport\GatewayApiDsn::fromDsn(
config('services.gatewayapi.dsn')
)
),
]);
});
}
GATEWAYAPI_DSN in .env (e.g., GATEWAYAPI_DSN=gatewayapi://TOKEN@default?from=FROM).Notifier via a Laravel-friendly interface:
facade(GatewayApiNotifier::class, \App\Facades\GatewayApiNotifier::class);
Notification classes to support GatewayApiOptions:
public function via($notifiable)
{
return ['gatewayapi'];
}
public function toGatewayApi($notifiable)
{
return (new SmsMessage($notifiable->phone, $this->message))
->options((new GatewayApiOptions())->label('payment_confirmation'));
}
\Log::channel('gatewayapi')) to track delivery status.GATEWAYAPI_DSN and message options in config/services.php for easier updates.How can I help you explore Laravel packages today?