ypl/transistor

This package is abandoned and no longer maintained. No replacement package was suggested.

dev-master 2018-06-29 12:15 UTC

This package is not auto-updated.

Last update: 2022-01-22 15:13:48 UTC


README

For Laravel 5.5

composer require ypl/transistor

Usage

Select a gateway and send an SMS message to recipient via the selected gateway.

Transistor::from('twilio', '+10000000000')->send('+10000000000', 'Test Message');

Extend Transistor adding&using your own gateways.

class AppServiceProvider extends ServiceProvider
{
    public function boot()
    {
        // Register a gateway
        Transistor::extend('nexmo', function (string $senderNumber) {
            return new NexmoGateway($this->app['config']->get('transistor.gateways.nexmo'), $senderNumber);
        });
    }
}

// Use the gateway
Transistor::from('nexmo', '+10000000000')->...

Coming Soon:

  • Testing Compatibility
Transistor::fake();

// Sending stuff

Transistor::assertSent('twilio', '+10000000000')->withMessage('bla bla');
  • Bulk Send
$recipients = [
    '+10000000001',
    '+10000000002' => 'Unique Text',
    '+10000000003',
];

$responses = Transistor::from('twilio', '+10000000000')->send($recipients, 'Bulk Test Message');

$responses->each(function (TwilioResponse $response) {
    //
});

$responses->whereNumber('+10000000001')->getMessageBody(); // Bulk Test Message
$responses->whereNumber('+10000000002')->getMessageBody(); // Unique Text