symfony/octopush-notifier
Symfony Notifier transport for Octopush SMS. Configure with an octopush:// DSN using your Octopush email and API key, plus sender and SMS type (LowCost, Premium, World) to send SMS notifications through Octopush.
Symfony/Laravel Alignment:
Symfony\Component\Notifier\ and its transport/channel architecture. Laravel’s native notification system (Illuminate\Notifications\) is incompatible without abstraction.Http facade or Guzzle can call Octopush’s API directly, bypassing Symfony dependencies. The package’s value lies in its DSN-based configuration and Symfony Notifier integration, which are less relevant to Laravel unless the app already uses Symfony components.OctopushChannel in Laravel Notifications).Use Case Suitability:
symfony/http-client, symfony/messenger) and willing to adopt symfony/notifier.Notification facade.Notification system is sufficient and Octopush’s API can be called directly.Laravel-Specific Risks:
symfony/notifier for a single provider adds ~50MB to vendor dependencies and introduces Symfony’s DI system.Transport vs. Laravel’s Channel) may complicate maintenance.Notifier tests (e.g., TransportFactoryTestCase) may not align with Laravel’s testing conventions..env (e.g., OCTOPUSH_DSN=octopush://user:key@default?from=123&type=FR).type=XXX|FR|WWW), but Laravel would need to parse these manually or via a helper.Channel implementations.Notifier uses events (e.g., NotificationFailed). Laravel’s Notification system uses callbacks, requiring adapters.config/services.php or .env). The package’s DSN format can be mirrored but isn’t Laravel-native.| Risk Area | Severity (Laravel) | Mitigation Strategy |
|---|---|---|
| Symfony Dependency | High | Avoid symfony/notifier; use direct API calls or minimal abstraction. |
| Laravel-Symfony Gap | Medium | Create a OctopushChannel in Laravel Notifications to wrap API calls. |
| API Rate Limits | Medium | Implement Laravel’s retry middleware or a custom decorator. |
| Vendor Lock-in | Low | Keep Octopush logic in a single service class. |
| Testing Overhead | Medium | Mock Octopush API in Laravel’s Http tests. |
| Maintenance Burden | High | Prefer direct API calls unless Symfony benefits are critical. |
Notifier features (e.g., retries, logging, multi-channel), or is a simple Http::post() sufficient?symfony/http-client (for API calls) without pulling in symfony/notifier?Laravel-Native Path (Recommended for Most Cases)
Http facade or Guzzle for API calls.Illuminate\Notifications) for channel abstraction.// config/services.php
'octopush' => [
'dsn' => env('OCTOPUSH_DSN'),
'from' => env('OCTOPUSH_FROM'),
];
// app/Services/OctopushClient.php
class OctopushClient {
public function sendSms(string $to, string $message) {
$response = Http::withOptions(['auth' => [$this->getCredentials()]])
->post('https://api.octopush.com/sms', [
'to' => $to,
'message' => $message,
'type' => $this->getType(),
]);
return $response->successful();
}
}
Symfony Bridge Path (For Advanced Use Cases)
symfony/http-client (for API calls).symfony/notifier (for multi-channel routing).// app/Providers/OctopushNotifierProvider.php
class OctopushNotifierProvider extends ServiceProvider {
public function register() {
$this->app->singleton('octopush.transport', function () {
return new OctopushTransport(
new Dsn('octopush://'.env('OCTOPUSH_USER').':'.env('OCTOPUSH_KEY').'@default?from='.env('OCTOPUSH_FROM').'&type='.env('OCTOPUSH_TYPE'))
);
});
}
}
Hybrid Path (Laravel Notifications + Octopush)
NotificationChannel to use Octopush.Notification facade for consistency.// app/Channels/OctopushChannel.php
class OctopushChannel extends Channel {
public function send($notifiable, Notification $notification) {
$client = new OctopushClient();
return $client->sendSms($notifiable->phone, $notification->toSms());
}
}
Http facade (Phase 1).symfony/notifier (Phase 3, high risk).OctopushClient service.OctopushClient to Laravel’s container.Notification or Channel as needed.v8.0.0-BETA1).XXX, FR, WWW).How can I help you explore Laravel packages today?