2017 © Pedro Peláez
 

library whatsatool-client

Laravel Package to communicate with the whatsatool API

image

campaigningbureau/whatsatool-client

Laravel Package to communicate with the whatsatool API

  • Wednesday, August 16, 2017
  • by christoph.schleifer
  • Repository
  • 2 Watchers
  • 0 Stars
  • 731 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 1 Open issues
  • 2 Versions
  • 2 % Grown

The README.md

Whats A Tool - Client

Description

This library gives you the basic functionality to communicate with the Whats A Tool API., (*1)

Whats a Tool MSISDN on Wikipedia, (*2)

Installation

First require in Composer:, (*3)

composer require campaigningbureau/whatsatool-client, (*4)

Add the Service Provider in your config/app.php:, (*5)

'providers' => [
    ...
    CampaigningBureau\WhatsAToolClient\WhatsAToolClientProvider::class,
]

You can also add the Facade there:, (*6)

'aliases' => [
    ...
    'WhatsAToolClient' =>  CampaigningBureau\WhatsAToolClient\WhatsAToolClientFacade::class,
]

Publish the config settings:, (*7)

$ php artisan vendor:publish

Configuration

After publishing the config file you can edit them in config/whatsatool.php., (*8)

Make sure you configure at least username and password., (*9)

The default_country_code is used to create the correct MSISDN when a phonenumber with local country code is given (e.g. 0664/1234567), (*10)

Usage

Validation

To validate a given number:, (*11)

$phonenumber = '+43 664 123 456 87';
CampaigningBureau\WhatsAToolClient\Msisdn::validatePhonenumber($phonenumber);

The Validation cleans the phonenumber, that means removes all non-numeric characters and leading 00 and checks if: 1. The cleaned phonenumber is not empty 2. The length is shorter or equal to 15 characters (funny fact: there is no official minimum lengt restriction) 3. The phonenumber starts with a valid Country Code, which is either 0 for local or a country code that can be found in this list., (*12)

Register Contact

To register a new Contact:, (*13)

$phonenumber = '+43 664 123 456 87';
$msisdn = new Msisdn($phonenumber);
try {
    $simMsisdn = WhatsATool::registerContact($msisdn, $channel, $sendSms);
} catch (WhatsAToolException $exception) {
    Log::error($exception->getMessage());
}

This returns the msisdn of the Sim the number is registered to or throws a WhatsAToolException with the error message of the WhatsATool-API., (*14)

Development

If you have PHPUnit installed in your environment, run:, (*15)

$ phpunit

If you don't have PHPUnit installed, you can run the following:, (*16)

$ composer update
$ ./vendor/bin/phpunit

Credits

The Msisdn-Logic is based on https://github.com/CoreProc/msisdn-ph-php/., (*17)

The Versions

16/08 2017

dev-master

9999999-dev

Laravel Package to communicate with the whatsatool API

  Sources   Download

MIT

The Requires

 

The Development Requires

by Christoph Schleifer

laravel whatsatool

02/08 2017

v1.0

1.0.0.0

Laravel Package to communicate with the whatsatool API

  Sources   Download

MIT

The Requires

 

The Development Requires

by Christoph Schleifer

laravel whatsatool