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 client to call Octopush’s API directly (recommended for minimal risk).Notifier as a microservice or use a facade pattern to decouple dependencies.Notifiable trait) or other providers (Twilio, Mailgun).Architectural Tradeoffs:
Notifier for retries, logging, and transport management.Core Features:
OCTOPUSH_DSN (e.g., octopush://login:key@default?from=Sender&type=FR), which can be adapted to Laravel’s .env or config/services.php.Database, Broadcast) may conflict.Transport interface can be mocked in Laravel via interfaces/facades.Dependency Conflicts:
symfony/http-client: May conflict with Laravel’s guzzlehttp/guzzle or illuminate/http.symfony/notifier: Not natively supported in Laravel; requires custom integration.replace or aliases to avoid conflicts."replace": {
"symfony/http-client": "symfony/http-client:^6.0",
"symfony/notifier": "symfony/notifier:^6.0"
}
Authentication:
env() or config/services.php)..env:
OCTOPUSH_LOGIN=your_login
OCTOPUSH_KEY=your_api_key
OCTOPUSH_FROM=SenderName
OCTOPUSH_TYPE=FR
| Risk Area | Severity | Mitigation Strategy |
|---|---|---|
| Symfony Dependency Bloat | High | Isolate Symfony components in a dedicated namespace or microservice. |
| Laravel-Symfony Integration Gap | High | Use facade pattern or HTTP facade to avoid direct coupling. |
| API Rate Limits | Medium | Implement exponential backoff in Laravel’s Http client. |
| Vendor Lock-in | Low | Abstract Octopush-specific logic behind interfaces. |
| Testing Complexity | Medium | Mock Octopush API responses using Laravel’s Http middleware or PHPUnit. |
| Maintenance Overhead | Medium | Assign ownership to a team member familiar with Symfony/Laravel hybrid stacks. |
Http facade)?Laravel-Native Approach (Recommended):
Http facade for API calls.Notification system for routing (if extending existing workflows).// app/Services/OctopushService.php
namespace App\Services;
use Illuminate\Support\Facades\Http;
class OctopushService {
public function sendSms(string $to, string $message): bool {
$response = Http::withOptions([
'auth' => [env('OCTOPUSH_LOGIN'), env('OCTOPUSH_KEY')],
'headers' => ['Content-Type' => 'application/json'],
])->post('https://api.octopush.com/sms', [
'to' => $to,
'message' => $message,
'from' => env('OCTOPUSH_FROM'),
'type' => env('OCTOPUSH_TYPE', 'FR'),
]);
return $response->successful();
}
}
Notifier features (e.g., retries, multi-channel).Symfony Bridge Approach (Advanced):
Notifier.Notifier component.ServiceProvider to bind Symfony services.composer require symfony/http-client symfony/notifier symfony/octopush-notifier
// app/Providers/OctopushNotifierProvider.php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
use Symfony\Component\Notifier\Notifier;
use Symfony\Component\Notifier\Transport\Dsn;
class OctopushNotifierProvider extends ServiceProvider {
public function register() {
$dsn = new Dsn('octopush://'.env('OCTOPUSH_LOGIN').':'.env('OCTOPUSH_KEY').'@default?from='.env('OCTOPUSH_FROM').'&type='.env('OCTOPUSH_TYPE', 'FR'));
$notifier = new Notifier([$dsn]);
$this->app->singleton('octopush.notifier', fn() => $notifier);
}
}
config/app.php.Notifier.Hybrid Approach:
Notifier for internal services (e.g., backend jobs) and Laravel’s Http facade for frontend/API layers.// For backend jobs (Symfony Notifier)
$notifier = app('octopush.notifier');
$notifier->send(new Message('Hello', new OctopushTransport()));
// For API routes (Laravel Http)
OctopushService::sendSms($to, $message);
Phase 1: Direct API Integration (1–2 weeks)
OctopushService using Laravel’s Http facade.Phase 2: Abstraction Layer (1 week)
OctopushClientInterface).interface OctopushClientInterface {
public function sendSms(string $to, string $message): bool;
}
Http-How can I help you explore Laravel packages today?