flotz/txtlocal

Wrapper for TxtLocal.co.uk

Installs: 463

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 1

Open Issues: 0

Type:symfony-bundle

1.0.0 2015-01-22 18:20 UTC

This package is not auto-updated.

Last update: 2024-04-13 14:07:55 UTC


README

This is just a Symfony Bundle Wrapper for Text Local with a bit of configuration.

Installation

In your composer.json file, add:

{
    "require": {
        "flotz/txtlocal" : "dev-master"
    }
}

In your app/AppKernel.php file, add:

{
    ...
    new Flotz\TxtLocalBundle\FlotzTxtLocalBundle(),
    ...
}

In your app/config/config.yml:

flotz_txt_local:
    username: your@email.com
    hash: "hash key here as provided by TextLocal"
    test: false # This is optional (default is true)
    apiKey: "api key here as provided by TextLocal" # This is optional

Then update your composer:

$ composer update

Usage

From a symfony controller:

    // Note: $number could be a simple mobile number:
    $number     = '447123123123';

    // or a comma separated serie of numbers:
    $number     = '447123123123, 447500400600';

    // or an array of numbers:
    $number     = array('447123123123', '447500400600');

    // $message is the content of the received SMS
    $message    = 'Thank you for using this bundle';

    // $sender is the name that will appear as a sender
    $sender     = 'Florent';

    $this->get('flotz_txtlocal')->sendSms($number, $message, $sender);
    $balance = $this->get('flotz_txtlocal')->getBalance();