sms77/api

Official API Client for requesting the Sms77.io SMS Gateway.

v2.5.0 2021-09-21 07:31 UTC

This package is auto-updated.

Last update: 2022-01-21 08:10:11 UTC


README

Sms77.io Logo

Official PHP API Client

Installation

Via Composer:

composer require sms77/api 

Alternatively you can download as *.ZIP if you don't use Composer.

Usage

use Sms77\Api\Client;
use Sms77\Api\Params\SmsParams;
$client = new Client('MY_VERY_SECRET_API_KEY!');
$params = new SmsParams();
$client->sms($params
    ->setTo('+4901234567890')
    ->setText('HI2U'));

Methods

Analytics
  • analytics(array options = [], string $groupBy = 'date'): AbstractAnalytic[]
  • analyticsByCountry(array options = []): AnalyticByCountry[]
  • analyticsByDate(array options = []): AnalyticByDate[]
  • analyticsByLabel(array options = []): AnalyticByLabel[]
  • analyticsBySubaccount(array options = []): AnalyticBySubaccount[]
Balance
  • balance(bool $json = false): float|Balance
  • balanceFloat(): float
  • balanceJson(): Balance
Contacts
  • contacts(string $action, array $options = []): mixed
  • createContact(bool $json = false): string|ContactCreate
  • createContactJson(): ContactCreate
  • deleteContact(int $id, bool $json = false): int|ContactDelete
  • deleteContactJson(int $id): ContactDelete
  • editContact(array $options): int|ContactEdit
  • editContactJson(array $options): ContactEdit
  • getContact(int $id, bool $json = false): string|Contact[]
  • getContactJson(int $id): Contact[]
  • getContacts(bool $json = false): string|Contact[]
  • getContactsJson(): Contact[]
Hooks
  • hooks(string $action, array $options = []): mixed
  • getHooks(): Hooks
  • subscribeHook(string $target_url, string $event_type, string $request_method = HooksConstants::REQUEST_METHOD_DEFAULT): HookAction
  • unsubscribeHook(?int $id, ?string $target_url = null, ?string $event_type = null, ?string $request_method = null): HookAction
Journal
  • journal(string $type, array $options = []): JournalBase[]
  • journalInbound(array $options = []): JournalInbound[]
  • journalOutbound(array $options = []): JournalOutbound[]
  • journalReplies(array $options = []): JournalReplies[]
  • journalVoice(array $options = []): JournalVoice[]
Lookup
  • lookup(string $type, string $number, array $options = []): mixed
  • lookupFormat(string $number): LookupFormat
  • lookupCnam(string $number): LookupCnam
  • lookupHlr(string $number): LookupHlr
  • lookupMnp(string $number, bool $json = false): string|LookupMnp
  • lookupMnpJson(string $number): LookupMnp
Pricing
  • pricing(bool $json = true, string $country = ''): string|Pricing
  • pricingCsv(string $country = ''): string
SMS
  • sms(SmsParamsInterface $params): string|Sms
  • smsJson(SmsParamsInterface $params): Sms
Status
  • status(int $msgId, bool $json = false): string|Status
  • statusJson(int $msgId): Status
Validate for Voice
  • validateForVoice(string $number, array $opts = []): ValidateForVoice
Voice
  • voice(VoiceParamsInterface $p): string|Voice
  • voiceJson(VoiceParamsInterface $p): Voice
Tests

Some basic tests are implemented. Run them like this:

SMS77_API_KEY= SMS77_RECIPIENT= SMS77_MSG_ID= php vendor/bin/phpunit tests/Client

Make sure to fill in the values. SMS77_MSG_ID refers to a message ID sent from this particular API key. SMS77_RECIPIENT is the recipient of the test SMS.

Support

Need help? Feel free to contact us.

MIT