sms77 / api
Official API Client for requesting the seven.io messaging Gateway.
Installs: 39 735
Dependents: 12
Suggesters: 0
Security: 0
Stars: 9
Watchers: 3
Forks: 4
Open Issues: 0
pkg:composer/sms77/api
Requires
- php: >=8.2
 - ext-ctype: *
 - ext-curl: *
 - ext-json: *
 - ext-mbstring: *
 
Requires (Dev)
- ext-simplexml: *
 - ext-soap: *
 - ext-xdebug: *
 - phpunit/phpunit: ^11
 
README
seven.io PHP SDK
The official PHP SDK for the seven.io SMS Gateway API
Documentation โข API Reference โข Support โข Dashboard
๐ฆ Installation
Via Composer (recommended)
composer require seven.io/api
Manual Installation
Download the latest release as ZIP file and include it in your project.
๐ Quick Start
Send your first SMS
<?php require 'vendor/autoload.php'; use Seven\Api\Client; use Seven\Api\Resource\Sms\SmsParams; use Seven\Api\Resource\Sms\SmsResource; // Initialize the client with your API key $client = new Client('YOUR_API_KEY'); // Create SMS resource $smsResource = new SmsResource($client); // Send SMS $response = $smsResource->dispatch( new SmsParams('Hello from seven.io!', '+491234567890') ); echo "SMS sent successfully! ID: " . $response->getMessages()[0]->getId();
๐ฑ Features
SMS Messaging
- โ Send SMS to single or multiple recipients
 - โ Bulk SMS support
 - โ Flash SMS
 - โ Unicode support
 - โ Delivery reports
 - โ Schedule messages
 
Voice Calls
- โ Text-to-Speech calls
 - โ Voice message broadcasts
 
Number Lookup
- โ HLR (Home Location Register) lookup
 - โ Number format validation
 - โ Carrier information
 - โ Number portability check
 
Other Features
- โ Balance inquiry
 - โ Pricing information
 - โ Webhook management
 - โ Contact management
 - โ Analytics & Journal
 
๐ป Usage Examples
Send SMS with custom sender
$params = (new SmsParams('Your message here', '+491234567890')) ->setFrom('YourBrand') ->setUnicode(true) ->setFlash(false); $response = $smsResource->dispatch($params);
Send bulk SMS
$params = new SmsParams( 'Bulk message to multiple recipients', ['+491234567890', '+491234567891', '+491234567892'] ); $response = $smsResource->dispatch($params);
Schedule SMS for later
$params = (new SmsParams('Scheduled message', '+491234567890')) ->setDelay(new \DateTime('+1 hour')); $response = $smsResource->dispatch($params);
Perform HLR lookup
use Seven\Api\Resource\Lookup\LookupResource; $lookupResource = new LookupResource($client); $result = $lookupResource->hlr('+491234567890'); echo "Carrier: " . $result->getCarrier(); echo "Country: " . $result->getCountry();
Check account balance
use Seven\Api\Resource\Balance\BalanceResource; $balanceResource = new BalanceResource($client); $balance = $balanceResource->get(); echo "Current balance: โฌ" . $balance->getAmount();
Text-to-Speech call
use Seven\Api\Resource\Voice\VoiceResource; use Seven\Api\Resource\Voice\VoiceParams; $voiceResource = new VoiceResource($client); $params = new VoiceParams('+491234567890', 'Hello, this is a test call'); $response = $voiceResource->call($params);
๐ง Advanced Configuration
Initialize with signing secret (for webhook validation)
$client = new Client( apiKey: 'YOUR_API_KEY', signingSecret: 'YOUR_SIGNING_SECRET' );
Error Handling
use Seven\Api\Exception\InvalidApiKeyException; use Seven\Api\Exception\InsufficientBalanceException; try { $response = $smsResource->dispatch($params); } catch (InvalidApiKeyException $e) { echo "Invalid API key provided"; } catch (InsufficientBalanceException $e) { echo "Not enough balance to send SMS"; } catch (\Exception $e) { echo "Error: " . $e->getMessage(); }
๐งช Testing
Run the test suite with your API credentials:
# Using production API key SEVEN_API_KEY=your_api_key php vendor/bin/phpunit tests # Using sandbox API key SEVEN_API_KEY_SANDBOX=your_sandbox_key php vendor/bin/phpunit tests
Run specific tests
# Test only SMS functionality php vendor/bin/phpunit tests/SmsTest.php # Test with verbose output php vendor/bin/phpunit tests --verbose
๐ API Resources
The SDK provides access to all seven.io API endpoints:
| Resource | Description | 
|---|---|
AnalyticsResource | 
Analytics and statistics | 
BalanceResource | 
Account balance | 
ContactsResource | 
Contact management | 
HooksResource | 
Webhook management | 
JournalResource | 
Message history | 
LookupResource | 
Number lookup & validation | 
PricingResource | 
Pricing information | 
RcsResource | 
RCS messaging | 
SmsResource | 
SMS messaging | 
StatusResource | 
Delivery reports | 
SubaccountsResource | 
Subaccount management | 
ValidateForVoiceResource | 
Voice number validation | 
VoiceResource | 
Voice calls | 
๐ Environment Variables
| Variable | Description | 
|---|---|
SEVEN_API_KEY | 
Your production API key | 
SEVEN_API_KEY_SANDBOX | 
Your sandbox API key for testing | 
SEVEN_SIGNING_SECRET | 
Webhook signing secret | 
๐ Requirements
- PHP 8.1 or higher
 - Composer (for installation)
 - ext-curl
 - ext-json
 
๐ค Contributing
We welcome contributions! Please see our Contributing Guide for details.
- Fork the repository
 - Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
 
๐ Support
- ๐ API Documentation
 - ๐ฌ Contact Support
 - ๐ Report Issues
 - ๐ก Feature Requests
 
๐ License
This project is licensed under the MIT License - see the LICENSE file for details.
Made with โค๏ธ by seven.io