Skip to content

Commit 568849f

Browse files
committed
Updated README.md
1 parent e049c57 commit 568849f

1 file changed

Lines changed: 102 additions & 2 deletions

File tree

README.md

Lines changed: 102 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,102 @@
1-
# send-api-php
2-
A library to interface with the Send API
1+
# MessageCloud Send PHP SDK
2+
The MessageCloud Send PHP SDK provides a convenient way to interact with the MessageCloud Send API for sending SMS messages.
3+
4+
## Installation
5+
To use the MessageCloud Send PHP SDK in your project, follow these steps:
6+
7+
Install Composer if you haven't already:
8+
9+
```bash
10+
curl -sS https://getcomposer.org/installer | php
11+
12+
mv composer.phar /usr/local/bin/composer
13+
```
14+
15+
Create a composer.json file in your project directory and add the following dependency:
16+
17+
```json
18+
{
19+
"require": {
20+
"messagecloud/send-api-php": "^1.0"
21+
}
22+
}
23+
```
24+
25+
Run Composer to install the dependencies:
26+
27+
```bash
28+
composer install
29+
```
30+
31+
If you already have composer in your project then it's as simple as this:
32+
33+
```bash
34+
composer require messagecloud/send-api-php
35+
```
36+
37+
## Authentication
38+
To use the SDK, you need to create an instance of the Authentication class with your username and password:
39+
40+
```php
41+
use MessageCloud\Send\Authentication;
42+
43+
$authentication = new Authentication('your-username', 'your-password');
44+
```
45+
46+
## Sending SMS
47+
To send an SMS message using the SDK, create an instance of the Sms class and pass the required parameters:
48+
49+
```php
50+
use MessageCloud\Send\Sms;
51+
52+
$message = new Sms('1234567890', 'sender', 'Hello, world!');
53+
```
54+
55+
Then, create an instance of the Client class and send the SMS:
56+
57+
```php
58+
use MessageCloud\Send\Client;
59+
60+
$client = new Client($authentication);
61+
$response = $client->send($message);
62+
63+
if ($response->wasSuccessful()) {
64+
echo "SMS sent successfully. ID: " . $response->getId();
65+
} else {
66+
echo "Failed to send SMS. Status: " . $response->getStatus();
67+
}
68+
```
69+
70+
## Running Tests
71+
To run unit tests for the SDK, you can use PHPUnit. Make sure you have PHPUnit installed:
72+
73+
```bash
74+
composer require --dev phpunit/phpunit
75+
```
76+
77+
Then, you can run the tests:
78+
79+
```bash
80+
vendor/bin/phpunit
81+
```
82+
83+
## Code Quality Checks
84+
This project uses PHPStan and PHP CS Fixer for code quality checks. You can run them using the following commands:
85+
86+
To analyze code with PHPStan:
87+
88+
```bash
89+
vendor/bin/phpstan analyse
90+
```
91+
92+
To fix coding standards violations with PHP CS Fixer:
93+
94+
```bash
95+
vendor/bin/php-cs-fixer fix --dry-run --stop-on-violation
96+
```
97+
98+
## Contributing
99+
If you find a bug or would like to contribute to this SDK, feel free to open an issue or submit a pull request.
100+
101+
## License
102+
This SDK is open-source software licensed under the BSD-2-Clause License. See the LICENSE file for more information.

0 commit comments

Comments
 (0)