Skip to content

Commit 5a5e494

Browse files
authored
Merge pull request #9 from mediaburst/composer
Composer support
2 parents 6b43b46 + 56129b0 commit 5a5e494

6 files changed

+93
-1052
lines changed

README.md

+25-11
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,30 @@ This wrapper lets you interact with Clockwork without the hassle of having to cr
1212

1313
## Usage
1414

15-
Require the Clockwork library:
15+
### Installing with composer
16+
The easiest way to get Clockwork is to use [Composer][4] to automatically download and include it in your project. Setup [Composer][4] and add us to your composer.json
17+
```php
18+
{
19+
"require": {
20+
"mediaburst/clockworksms": "2.0.*"
21+
}
22+
}
23+
```
24+
If you are using your own autoloader we are using the PSR-4 namespacing scheme.
25+
26+
### Including directly
27+
28+
Download the Clockwork library, put it in your project and require the Clockwork class and the ClockworkException classes:
1629

1730
```php
18-
require 'class-Clockwork.php';
31+
require 'src/Clockwork.php';
32+
require 'src/ClockworkException.php';
1933
```
2034

2135
### Sending a message
2236

2337
```php
24-
$clockwork = new Clockwork( $API_KEY ); //Be careful not to post your API Keys to public repositories.
38+
$clockwork = new mediaburst\ClockworkSMS\Clockwork( $API_KEY ); //Be careful not to post your API Keys to public repositories.
2539
$message = array( 'to' => '441234567891', 'message' => 'This is a test!' );
2640
$result = $clockwork->send( $message );
2741
```
@@ -31,7 +45,7 @@ $result = $clockwork->send( $message );
3145
We recommend you use batch sizes of 500 messages or fewer. By limiting the batch size it prevents any timeouts when sending.
3246

3347
```php
34-
$clockwork = new Clockwork( $API_KEY ); //Be careful not to post your API Keys to public repositories.
48+
$clockwork = new mediaburst\ClockworkSMS\Clockwork( $API_KEY ); //Be careful not to post your API Keys to public repositories.
3549
$messages = array(
3650
array( 'to' => '441234567891', 'message' => 'This is a test!' ),
3751
array( 'to' => '441234567892', 'message' => 'This is a test 2!' )
@@ -109,7 +123,7 @@ For example, if you send to invalid phone number "abc":
109123
Check your available SMS balance:
110124

111125
```php
112-
$clockwork = new Clockwork( $API_KEY ); //Be careful not to post your API Keys to public repositories.
126+
$clockwork = new mediaburst\ClockworkSMS\Clockwork( $API_KEY ); //Be careful not to post your API Keys to public repositories.
113127
$clockwork->checkBalance();
114128
```
115129

@@ -132,11 +146,11 @@ The Clockwork wrapper will throw a `ClockworkException` if the entire call faile
132146
```php
133147
try
134148
{
135-
$clockwork = new Clockwork( 'invalid_key' );
149+
$clockwork = new mediaburst\ClockworkSMS\Clockwork( 'invalid_key' );
136150
$message = array( 'to' => 'abc', 'message' => 'This is a test!' );
137151
$result = $clockwork->send( $message );
138152
}
139-
catch( ClockworkException $e )
153+
catch( mediaburst\ClockworkSMS\ClockworkException $e )
140154
{
141155
print $e->getMessage();
142156
// Invalid API Key
@@ -185,7 +199,7 @@ In this example both messages will be sent from Clockwork:
185199

186200
```php
187201
$options = array( 'from' => 'Clockwork' );
188-
$clockwork = new Clockwork( $API_KEY, $options ); //Be careful not to post your API Keys to public repositories.
202+
$clockwork = new mediaburst\ClockworkSMS\Clockwork( $API_KEY, $options ); //Be careful not to post your API Keys to public repositories.
189203
$messages = array(
190204
array( 'to' => '441234567891', 'message' => 'This is a test!' ),
191205
array( 'to' => '441234567892', 'message' => 'This is a test 2!' )
@@ -200,7 +214,7 @@ Set option values individually on each message.
200214
In this example, one message will be from Clockwork and the other from 84433:
201215

202216
```php
203-
$clockwork = new Clockwork( $API_KEY, $options ); //Be careful not to post your API Keys to public repositories.
217+
$clockwork = new mediaburst\ClockworkSMS\Clockwork( $API_KEY, $options ); //Be careful not to post your API Keys to public repositories.
204218
$messages = array(
205219
array( 'to' => '441234567891', 'message' => 'This is a test!', 'from' => 'Clockwork' ),
206220
array( 'to' => '441234567892', 'message' => 'This is a test 2!', 'from' => '84433' )
@@ -228,7 +242,7 @@ If you're seeing this error there are two fixes available, the first is easy, si
228242

229243
```php
230244
$options = array( 'ssl' => false );
231-
$clockwork = new Clockwork( $API_KEY, $options ); //Be careful not to post your API Keys to public repositories.
245+
$clockwork = new mediaburst\ClockworkSMS\Clockwork( $API_KEY, $options ); //Be careful not to post your API Keys to public repositories.
232246
```
233247

234248
#### Setup SSL root certificates on your server
@@ -254,4 +268,4 @@ and submit a pull request.
254268
[1]: mailto:[email protected]
255269
[2]: http://www.clockworksms.com/
256270
[3]: https://github.com/mediaburst/clockwork-php
257-
271+
[4]: https://getcomposer.org/

composer.json

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"name": "mediaburst/clockworksms",
3+
"description": "ClockworkSMS, International SMS API",
4+
"license": "MIT",
5+
"keywords": ["sms"],
6+
"authors": [
7+
{
8+
"name": "Andrew Wise",
9+
"email": "[email protected]"
10+
}
11+
],
12+
"require": {},
13+
"require-dev": {},
14+
"autoload": {
15+
"psr-4": {
16+
"mediaburst\\ClockworkSMS\\": "src"
17+
}
18+
}
19+
}

0 commit comments

Comments
 (0)