NAME

Mojolicious::Plugin::SMS - Easy SMS sending from Mojolicious apps

SYNOPSIS

  # Mojolicious::Lite
  plugin 'SMS' => {
    driver    => 'Test'
  };

  # Mojolicious
  $self->plugin(SMS => {
    driver    => 'Nexmo',
    _username => 'testuser',
    _password => 'testpassword'
    _from     => 'Bender'
  });

  # in controller named params
  $self->sms(
    to   => '+380506022375',
    text => 'use Perl or die;'
  );

  # in controller positional params
  $self->sms('+380506022375', 'use Perl or die;');

DESCRIPTION

Provides a quick and easy way to send SMS messages using SMS::Send drivers (of which there are many, so chances are the service you want to use is already supported; if not, they're easy to write, and if you want to change providers later, you can simply update a few lines in your config file, and you're done.

OPTIONS

Mojolicious::Plusin::SMS has one required option 'driver', all other options are passed to appropriate SMS::Send driver.

driver

SMS::Send driver name. This is a required option. You may specify 'Test' if you need a testing driver.

HELPERS

Mojolicious::Plugin::SMS implements one helper.

sms

Send an SMS message. You can pass the destination and message as positional params:

    sms $to, $message;

Or, you can use named params:

    sms to => $to, text => $message;

The latter form may be clearer, and would allow any additional driver-specific parameters to be passed too, but the former is terser. The choice is yours.

METHODS

Mojolicious::Plugin::SMS inherits all methods from Mojolicious::Plugin and implements the following new ones.

register

$plugin->register;

Register plugin hooks and helpers in Mojolicious application.

SEE ALSO

Mojolicious, SMS::Send, SMS::Send::Test.

AUTHOR

Yuriy Syrota <ysyrota@gmail.com>

COPYRIGHT & LICENSE

Copyright (C) 2011 by Yuriy Syrota.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.