2017 © Pedro Peláez
 

library telco

Wrapper around the AfricasTalking api

image

kagga/telco

Wrapper around the AfricasTalking api

  • Tuesday, January 17, 2017
  • by Kagga
  • Repository
  • 1 Watchers
  • 2 Stars
  • 36 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 16 % Grown

The README.md

Telco

Telco is a package wrapper around the AfricasTalking api. This package has been developed for Laravel 5+., (*1)

The package makes it easy to send an sms from your application to a phone., (*2)

Installation

As other laravel packages, Telco is installed via composer., (*3)

In your terminal at the project root run, (*4)

```$xslt composer require kagga/telco, (*5)



After add the service provider to `config/app.php` in the providers section ```$xslt 'providers' => [ Kagga\Telco\TelcoServiceProvider::class ],

Then also add the Facade aliases in config/app.php within the alias section., (*6)

```$xslt 'aliases' => [ 'Telco' => Kagga\Telco\facades\Telco::class, ],, (*7)



## Configuration Now we are going to config the AfricasTalking api. Head over to your account or sign up to get your api key and username and jey hold of them. Publish the package config file to the `config` folder in your app by running this in your terminal. ```$xslt php artisan vendor:publish --tag=config

The config file called telco.php will be moved to config/telco.php., (*8)

Then add your username and api key to the .env file using these keys, (*9)

```$xslt SMS_USERNAME=yourUsername SMS_API_KEY=yourapi-key, (*10)

 Thats all with the configuration.

 You are about to get done, just one for thing. You can test out whether its working by serving your app `php artisan serve` 
 and checking `http://localhost/telco/send` The view at this url comes bundled in the package only for testing purposes.

  A success message will be showed after you send the message or an error 
  message if something goes wrong.

## Usage
  At the moment the package has two methods, one for sending `send` an sms and the other
  the `api` that exposes the AfricasTalking Gateway.

  With the `api` method you can access all the public methods in the 
  [AfricasTalkingGateway](http://docs.africastalking.com/sms/sending) .

### Example code
  ```$xslt
Illuminate\Support\Facades\Route::post('/telco/send', function (\Kagga\Telco\contracts\TelcoInterface $telco) {

    $phonenumber = request('tel'); //Used the request laravel helper to get the phone number from a phone

    $message = request('message'); //Getting the message from the form

    $results = $telco->send($phonenumber, $message);

    if ($results != null) {

        return "Message has been sent successful to " . $phonenumber;
    }
});

You can also use the Telco facade that comes with the package to send a message., (*11)

$xslt Telco::send($phonenumber, $message); Do not forget to add the facade import statement use Kagga\Telco\facades\Telco;, (*12)

Thats it., (*13)

Thanks for using this package., (*14)

Let me know what you develop with this package. By sending me an email Johnkagga@gmail.com or @johnkagga, (*15)

The Versions

17/01 2017

dev-master

9999999-dev

Wrapper around the AfricasTalking api

  Sources   Download

MIT

by John Kagga

17/01 2017

1.0.2

1.0.2.0

Wrapper around the AfricasTalking api

  Sources   Download

MIT

by John Kagga

17/01 2017

1.0.1

1.0.1.0

Wrapper around the AfricasTalking api

  Sources   Download

MIT

by John Kagga

17/01 2017

1.0.0

1.0.0.0

Wrapper around the AfricasTalking api

  Sources   Download

MIT

by John Kagga