symfony/spot-hit-notifier
Symfony Notifier transport for Spot-Hit SMS. Configure via SPOTHIT_DSN with your API token and sender (from), with optional settings for long SMS and concatenation count validation. Links to Spot-Hit API docs and Symfony issue/PR channels.
Notifier component, which relies on HttpClient, Messenger, and DependencyInjection. Laravel’s native alternatives (e.g., Illuminate\HttpClient, Illuminate\Queue, Illuminate\Container) require adaptation layers to mimic Symfony’s behavior. Key mismatches:
Bus facade for message dispatch.Events system. Event listeners would need refactoring (e.g., using Laravel’s dispatch() or listen()).spothit://TOKEN@default) isn’t natively supported in Laravel. A custom config resolver or facade would be required.smslongnbr, sender customization, or analytics), this package may justify integration. Otherwise, Laravel’s existing notifiers (e.g., spatie/laravel-notification-channels-sms) could suffice.Symfony\Component\Notifier\Transport\TransportInterface. In Laravel, this would require:
SpotHitTransport class implementing Laravel’s NotificationChannelInterface or a wrapper around Illuminate\Bus\Queueable.class SpotHitTransport implements NotificationChannelInterface {
public function send(Notifiable $notifiable, array $options) {
$http = new \Illuminate\HttpClient\PendingRequest();
return $http->post('https://api.spot-hit.com/sms', [
'token' => config('services.spot_hit.token'),
'to' => $notifiable->route('phone'),
'message' => $options['message']
]);
}
}
config/packages/spot_hit_notifier.yaml must be translated to Laravel’s config/services.php or a custom config file:
'spot_hit' => [
'dsn' => env('SPOTHIT_DSN', 'spothit://TOKEN@default?from=FROM'),
'from' => env('SPOTHIT_FROM', '12345'),
'smslong' => env('SPOTHIT_SMSLONG', false),
],
SpotHitNotifier) would need to be registered in Laravel’s container via AppServiceProvider:
$this->app->singleton(SpotHitNotifier::class, function ($app) {
return new SpotHitNotifier($app['config']['spot_hit.dsn']);
});
HttpClient uses PSR-18, while Laravel’s HttpClient uses Guzzle under the hood—API responses or retries may behave differently.TransportFactoryTestCase) would need to be rewritten for Laravel’s testing tools (e.g., Pest, PHPUnit with Laravel extensions).HttpClient or Messenger.smslongnbr, webhooks) supported by this package, or will custom logic be needed?spatie/laravel-notification-channels-sms or a direct Spot-Hit SDK been considered? If so, what are the trade-offs (e.g., maintenance, features)?Laravel Compatibility Matrix:
| Symfony Component | Laravel Equivalent | Integration Strategy | Risk |
|---|---|---|---|
HttpClient |
Illuminate\HttpClient or Guzzle |
Adapter class to normalize requests/responses | Medium |
Messenger |
Illuminate\Queue |
Custom transport + queue listeners | High |
DependencyInjection |
Illuminate\Container |
Service provider registration | Low |
EventDispatcher |
Illuminate\Events |
Event facade wrappers or manual dispatch | Medium |
Notifier |
Illuminate\Notifications |
Custom channel implementation | High |
Recommended Stack:
HttpClient (Laravel 10+) with a request adapter to handle Spot-Hit’s API.SpotHitTransport class extending Illuminate\Bus\Queueable.config/services.php with environment variables.Pest or PHPUnit with Laravel’s MockHttpClient or QueueWorker for isolation.SpotHitTransport class to send SMS via Spot-Hit’s API.Notifier with Laravel’s Notifications system.Url component to parse spothit://TOKEN@default. Replace with Laravel’s Illuminate\Support\Str or a custom parser.TransportFactory may need a Laravel equivalent (e.g., a service provider to instantiate transports).queue:work command to process notifications asynchronously.event() facade or dispatch() method.HttpClient compatibility.How can I help you explore Laravel packages today?