-
Notifications
You must be signed in to change notification settings - Fork 0
Documentation
In order to use this library, you will need a ThingsMobile API token. This requires an account to use with the production API (and can be generated here), however there are credentials for the staging API provided - these are included in the examples folder of this library, and are used for any example code in the wiki.
In order to use the library, a client object is required to be created. The client class constructor takes 3 parameters: username, API token, and environment - this is only required if you wish to use the development environment.
<?php
$client = new \ThingsMobilePHP\Client(
'TMTEST',
'91c6ce3c-a848-4f0e-bfca-ab9eeff5d1e6',
\ThingsMobilePHP\Client::ENVIRONMENT_DEVELOPMENT
);
Activates a specified sim. Requires MSISDN and ICCID to be set.
$sim = new \ThingsMobilePHP\Models\Sim();
$sim->setMsisdn('882360000000004')->setIccid('');
$client->sim()->activate($sim);
Block a specified SIM. Requires either MSISDN or ICCID to be set on SIM object.
$sim = new \ThingsMobilePHP\Models\Sim();
$sim->setMsisdn('882360000000004');
$client->sim()->block($sim);
Unblock a specified SIM. Requires either MSISDN or ICCID to be set on SIM object.
$sim = new \ThingsMobilePHP\Models\Sim();
$sim->setMsisdn('882360000000004');
$client->sim()->unblock($sim);
Get SIM status. Requires either MSISDN or ICCID to be set on SIM object. Returns a SIM model with all fields populated.
$sim = new \ThingsMobilePHP\Models\Sim();
$sim->setMsisdn('882360000000004');
$sim = $client->sim()->status($sim);
// eg. $sim->getBalance();
List all sims in account. Allows optional searching by tag or name, which can be passed as an array - the first parameter accepted by the method.
$allSims = $client->sim()->list();
$specificSims = $client->sim()->list(['name' => 'test']);
Update any changed attributes on the provided SIM object. Requires either MSISDN or ICCID to be set on SIM object. The values which can be updated are:
- name
- tag
- expirationDate
- blockSim
- dailyLimit
- blockSimDaily
- monthlyLimit
- blockSimMonthly
- totalLimit
- blockSimTotal
This method combines multiple API endpoint calls to simplify usage.
$sim = new \ThingsMobilePHP\Models\Sim();
$sim->setMsisdn('882360000000004');
$sim->setName('new name')->setTag('tag')->setDailyLimit(100);
$client->sim()->update($sim);
Send a SMS to a specified SIM. Message can be up to 160 characters.
$sim = new \ThingsMobilePHP\Models\Sim();
$sim->setMsisdn('882360000000004');
$client->sms()->send($sim, 'message to send here');