|
| 1 | +Welcome to __Instasent PHP SDK__. This repository contains Instasent's PHP SDK and samples for REST API. |
| 2 | + |
| 3 | +## Installation |
| 4 | + |
| 5 | +You can install **instasent-php-lib** via composer or by downloading the source. |
| 6 | + |
| 7 | +#### Via Composer: |
| 8 | + |
| 9 | +You need to run: |
| 10 | + |
| 11 | +``` |
| 12 | +composer require "instasent/instasent-php-lib" |
| 13 | +``` |
| 14 | + |
| 15 | +#### Via ZIP file: |
| 16 | + |
| 17 | +[Click here to download the source |
| 18 | +(.zip)](https://github.com/instasent/instasent-php-lib/zipball/master) |
| 19 | + |
| 20 | +Once you download the library, move the instasent-php-lib folder to your project |
| 21 | +directory and then include the library file: |
| 22 | + |
| 23 | + require '/path/to/instasent-php-lib/src/Instasent/InstasentClient.php'; |
| 24 | + |
| 25 | +and now you can use it! |
| 26 | + |
| 27 | +## Quickstart |
| 28 | + |
| 29 | +### Send an SMS |
| 30 | + |
| 31 | +You can check 'examples/send-sms.php' file. |
| 32 | + |
| 33 | +#### Composer way |
| 34 | + |
| 35 | +```php |
| 36 | +<?php |
| 37 | + |
| 38 | +require __DIR__ . '/../vendor/autoload.php'; |
| 39 | + |
| 40 | +$instasentClient = new Instasent\InstasentClient("my-token"); |
| 41 | +$response = $instasentClient->sendSms("test", "+34647000000", "test message"); |
| 42 | + |
| 43 | +echo $response["response_code"]; |
| 44 | +echo $response["response_body"]; |
| 45 | +``` |
| 46 | + |
| 47 | +#### Direct way |
| 48 | + |
| 49 | +```php |
| 50 | +<?php |
| 51 | + |
| 52 | +require_once(__DIR__ . '/path/to/lib/InstasentClient.php'); |
| 53 | + |
| 54 | +$instasentClient = new Instasent\InstasentClient("my-token"); |
| 55 | +$response = $instasentClient->sendSms("test", "+34647000000", "test message"); |
| 56 | + |
| 57 | +echo $response["response_code"]; |
| 58 | +echo $response["response_body"]; |
| 59 | +``` |
| 60 | + |
| 61 | +### Get SMS Info |
| 62 | + |
| 63 | +#### Composer way |
| 64 | + |
| 65 | +```php |
| 66 | + |
| 67 | +require __DIR__ . '/../vendor/autoload.php'; |
| 68 | + |
| 69 | +$instasentClient = new Instasent\InstasentClient("my-token"); |
| 70 | +$response = $instasentClient->getSmsById("smsId"); |
| 71 | + |
| 72 | +echo $response["response_code"]; |
| 73 | +echo $response["response_body"]; |
| 74 | +``` |
| 75 | + |
| 76 | +#### Direct way |
| 77 | + |
| 78 | +```php |
| 79 | + |
| 80 | +require_once(__DIR__ . '/path/to/lib/InstasentClient.php'); |
| 81 | + |
| 82 | +$instasentClient = new Instasent\InstasentClient("my-token"); |
| 83 | +$response = $instasentClient->getSmsById("smsId"); |
| 84 | + |
| 85 | +echo $response["response_code"]; |
| 86 | +echo $response["response_body"]; |
| 87 | +``` |
| 88 | + |
| 89 | +## [Full Documentation](http://docs.instasent.com/) |
| 90 | + |
| 91 | +## Prerequisites |
| 92 | + |
| 93 | +* PHP >= 5.2.3 |
| 94 | + |
| 95 | +# Getting help |
| 96 | + |
| 97 | +If you need help installing or using the library, please contact Instasent Support at support@instasent.com first. |
| 98 | +If you've instead found a bug in the library or would like new features added, go ahead and open issues or pull requests against this repo! |
0 commit comments