Skip to content

Commit 1887de7

Browse files
cl77claude
andcommitted
docs: improve README and add .DS_Store to gitignore
- Enhance README with comprehensive documentation - Add badges for version, downloads, license, and PHP version - Include detailed usage examples for all features - Add API resources table and environment variables section - Add .DS_Store to .gitignore for macOS compatibility πŸ€– Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent d0451b8 commit 1887de7

File tree

2 files changed

+230
-25
lines changed

2 files changed

+230
-25
lines changed

β€Ž.gitignoreβ€Ž

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@ vendor/
44
.phpunit.result.cache
55
.phpdoc/
66
index.php
7-
.idea/
7+
.idea/
8+
.DS_Store

β€ŽREADME.mdβ€Ž

Lines changed: 228 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,257 @@
11
<img src="https://www.seven.io/wp-content/uploads/Logo.svg" width="250" />
22

3-
# Official PHP API Client
3+
# seven.io PHP SDK
44

5-
## Installation
5+
[![Latest Stable Version](https://img.shields.io/packagist/v/seven.io/api.svg)](https://packagist.org/packages/seven.io/api)
6+
[![Total Downloads](https://img.shields.io/packagist/dt/seven.io/api.svg)](https://packagist.org/packages/seven.io/api)
7+
[![License](https://img.shields.io/badge/License-MIT-teal.svg)](LICENSE)
8+
[![PHP Version](https://img.shields.io/packagist/php-v/seven.io/api.svg)](https://packagist.org/packages/seven.io/api)
69

7-
**Via Composer:**
10+
**The official PHP SDK for the seven.io SMS Gateway API**
811

9-
```shell script
12+
[Documentation](https://www.seven.io/en/docs/gateway/http-api/) β€’ [API Reference](/docs) β€’ [Support](https://www.seven.io/en/company/contact/) β€’ [Dashboard](https://app.seven.io/)
13+
14+
---
15+
16+
## πŸ“¦ Installation
17+
18+
### Via Composer (recommended)
19+
20+
```bash
1021
composer require seven.io/api
1122
```
1223

13-
Alternatively you
14-
can [download as *.ZIP](https://github.com/seven-io/php-client/releases/latest "download as *.ZIP")
15-
if you don't use Composer.
24+
### Manual Installation
25+
26+
Download the latest release as [ZIP file](https://github.com/seven-io/php-client/releases/latest) and include it in your project.
1627

17-
### Usage
28+
## πŸš€ Quick Start
29+
30+
### Send your first SMS
1831

1932
```php
33+
<?php
34+
require 'vendor/autoload.php';
35+
2036
use Seven\Api\Client;
2137
use Seven\Api\Resource\Sms\SmsParams;
2238
use Seven\Api\Resource\Sms\SmsResource;
2339

24-
$client = new Client('MY_VERY_SECRET_API_KEY!');
40+
// Initialize the client with your API key
41+
$client = new Client('YOUR_API_KEY');
42+
43+
// Create SMS resource
2544
$smsResource = new SmsResource($client);
26-
$smsParams = new SmsParams('HI2U', '+4901234567890');
27-
$res = $smsResource->dispatch($smsParams);
28-
var_dump($res);
45+
46+
// Send SMS
47+
$response = $smsResource->dispatch(
48+
new SmsParams('Hello from seven.io!', '+491234567890')
49+
);
50+
51+
echo "SMS sent successfully! ID: " . $response->getMessages()[0]->getId();
52+
```
53+
54+
## πŸ“± Features
55+
56+
### SMS Messaging
57+
- βœ… Send SMS to single or multiple recipients
58+
- βœ… Bulk SMS support
59+
- βœ… Flash SMS
60+
- βœ… Unicode support
61+
- βœ… Delivery reports
62+
- βœ… Schedule messages
63+
64+
### Voice Calls
65+
- βœ… Text-to-Speech calls
66+
- βœ… Voice message broadcasts
67+
68+
### Number Lookup
69+
- βœ… HLR (Home Location Register) lookup
70+
- βœ… Number format validation
71+
- βœ… Carrier information
72+
- βœ… Number portability check
73+
74+
### Other Features
75+
- βœ… Balance inquiry
76+
- βœ… Pricing information
77+
- βœ… Webhook management
78+
- βœ… Contact management
79+
- βœ… Analytics & Journal
80+
81+
## πŸ’» Usage Examples
82+
83+
### Send SMS with custom sender
84+
85+
```php
86+
$params = (new SmsParams('Your message here', '+491234567890'))
87+
->setFrom('YourBrand')
88+
->setUnicode(true)
89+
->setFlash(false);
90+
91+
$response = $smsResource->dispatch($params);
92+
```
93+
94+
### Send bulk SMS
95+
96+
```php
97+
$params = new SmsParams(
98+
'Bulk message to multiple recipients',
99+
['+491234567890', '+491234567891', '+491234567892']
100+
);
101+
102+
$response = $smsResource->dispatch($params);
103+
```
104+
105+
### Schedule SMS for later
106+
107+
```php
108+
$params = (new SmsParams('Scheduled message', '+491234567890'))
109+
->setDelay(new \DateTime('+1 hour'));
110+
111+
$response = $smsResource->dispatch($params);
112+
```
113+
114+
### Perform HLR lookup
115+
116+
```php
117+
use Seven\Api\Resource\Lookup\LookupResource;
118+
119+
$lookupResource = new LookupResource($client);
120+
$result = $lookupResource->hlr('+491234567890');
121+
122+
echo "Carrier: " . $result->getCarrier();
123+
echo "Country: " . $result->getCountry();
29124
```
30125

31-
See [docs](/docs) for more details.
126+
### Check account balance
32127

33-
##### Tests
128+
```php
129+
use Seven\Api\Resource\Balance\BalanceResource;
130+
131+
$balanceResource = new BalanceResource($client);
132+
$balance = $balanceResource->get();
133+
134+
echo "Current balance: €" . $balance->getAmount();
135+
```
136+
137+
### Text-to-Speech call
138+
139+
```php
140+
use Seven\Api\Resource\Voice\VoiceResource;
141+
use Seven\Api\Resource\Voice\VoiceParams;
142+
143+
$voiceResource = new VoiceResource($client);
144+
$params = new VoiceParams('+491234567890', 'Hello, this is a test call');
145+
146+
$response = $voiceResource->call($params);
147+
```
148+
149+
## πŸ”§ Advanced Configuration
34150

35-
Some basic tests are implemented. You can run them like this:
151+
### Initialize with signing secret (for webhook validation)
36152

37-
```shell script
38-
SEVEN_API_KEY=<API-KEY> php vendor/bin/phpunit tests
153+
```php
154+
$client = new Client(
155+
apiKey: 'YOUR_API_KEY',
156+
signingSecret: 'YOUR_SIGNING_SECRET'
157+
);
39158
```
40159

41-
or
160+
### Error Handling
161+
162+
```php
163+
use Seven\Api\Exception\InvalidApiKeyException;
164+
use Seven\Api\Exception\InsufficientBalanceException;
42165

43-
```shell script
44-
SEVEN_API_KEY_SANDBOX=<SANDBOX-API-KEY> php vendor/bin/phpunit tests
166+
try {
167+
$response = $smsResource->dispatch($params);
168+
} catch (InvalidApiKeyException $e) {
169+
echo "Invalid API key provided";
170+
} catch (InsufficientBalanceException $e) {
171+
echo "Not enough balance to send SMS";
172+
} catch (\Exception $e) {
173+
echo "Error: " . $e->getMessage();
174+
}
45175
```
46176

47-
Make sure to fill in the values.
177+
## πŸ§ͺ Testing
178+
179+
Run the test suite with your API credentials:
180+
181+
```bash
182+
# Using production API key
183+
SEVEN_API_KEY=your_api_key php vendor/bin/phpunit tests
184+
185+
# Using sandbox API key
186+
SEVEN_API_KEY_SANDBOX=your_sandbox_key php vendor/bin/phpunit tests
187+
```
188+
189+
### Run specific tests
190+
191+
```bash
192+
# Test only SMS functionality
193+
php vendor/bin/phpunit tests/SmsTest.php
194+
195+
# Test with verbose output
196+
php vendor/bin/phpunit tests --verbose
197+
```
198+
199+
## πŸ“š API Resources
200+
201+
The SDK provides access to all seven.io API endpoints:
202+
203+
| Resource | Description |
204+
|----------|-------------|
205+
| `AnalyticsResource` | Analytics and statistics |
206+
| `BalanceResource` | Account balance |
207+
| `ContactsResource` | Contact management |
208+
| `HooksResource` | Webhook management |
209+
| `JournalResource` | Message history |
210+
| `LookupResource` | Number lookup & validation |
211+
| `PricingResource` | Pricing information |
212+
| `RcsResource` | RCS messaging |
213+
| `SmsResource` | SMS messaging |
214+
| `StatusResource` | Delivery reports |
215+
| `SubaccountsResource` | Subaccount management |
216+
| `ValidateForVoiceResource` | Voice number validation |
217+
| `VoiceResource` | Voice calls |
218+
219+
## πŸ”‘ Environment Variables
220+
221+
| Variable | Description |
222+
|----------|-------------|
223+
| `SEVEN_API_KEY` | Your production API key |
224+
| `SEVEN_API_KEY_SANDBOX` | Your sandbox API key for testing |
225+
| `SEVEN_SIGNING_SECRET` | Webhook signing secret |
226+
227+
## πŸ“„ Requirements
228+
229+
- PHP 8.1 or higher
230+
- Composer (for installation)
231+
- ext-curl
232+
- ext-json
233+
234+
## 🀝 Contributing
235+
236+
We welcome contributions! Please see our [Contributing Guide](CONTRIBUTING.md) for details.
237+
238+
1. Fork the repository
239+
2. Create your feature branch (`git checkout -b feature/amazing-feature`)
240+
3. Commit your changes (`git commit -m 'Add some amazing feature'`)
241+
4. Push to the branch (`git push origin feature/amazing-feature`)
242+
5. Open a Pull Request
243+
244+
## πŸ†˜ Support
245+
246+
- πŸ“– [API Documentation](https://www.seven.io/en/docs/gateway/http-api/)
247+
- πŸ’¬ [Contact Support](https://www.seven.io/en/company/contact/)
248+
- πŸ› [Report Issues](https://github.com/seven-io/php-client/issues)
249+
- πŸ’‘ [Feature Requests](https://github.com/seven-io/php-client/issues/new?labels=enhancement)
250+
251+
## πŸ“œ License
48252

49-
###### Support
253+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
50254

51-
Need help? Feel free to [contact us](https://www.seven.io/en/company/contact/).
255+
---
52256

53-
[![MIT](https://img.shields.io/badge/License-MIT-teal.svg)](LICENSE)
257+
Made with ❀️ by [seven.io](https://www.seven.io)

0 commit comments

Comments
Β (0)