1. Go to this page and download the library: Download sms77/api library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
sms77 / api example snippets
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();
use Seven\Api\Resource\Lookup\LookupResource;
$lookupResource = new LookupResource($client);
$result = $lookupResource->hlr('+491234567890');
echo "Carrier: " . $result->getCarrier();
echo "Country: " . $result->getCountry();
use Seven\Api\Resource\Balance\BalanceResource;
$balanceResource = new BalanceResource($client);
$balance = $balanceResource->get();
echo "Current balance: €" . $balance->getAmount();
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);
$client = new Client(
apiKey: 'YOUR_API_KEY',
signingSecret: 'YOUR_SIGNING_SECRET'
);
bash
# 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
bash
# Test only SMS functionality
php vendor/bin/phpunit tests/SmsTest.php
# Test with verbose output
php vendor/bin/phpunit tests --verbose
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.