This is an SDK for the Telnyx API v2
NOTE Because the v2 API is still in development some of the v1 endpoints will exist in the
\Lonnylot\Telnyx\Legacy
namespace.
You can install the bindings via Composer. Run the following command:
composer require lonnylot/telnyx-php-sdk dev-master
To use the bindings, use Composer's autoload:
require_once('vendor/autoload.php');
The library requires the CrudSugar library.
This library was made so you can interact with the Telnyx APIs.
Table of Contents
The resources are named as follows:
index
- Telnyx "List"show
- Telnyx "Retrieve"update
- Telnyx "Update"delete
- Telnyx "Delete"store
- Telnyx "Create"
messagingProfile
numberOrder
numberSearch
phoneNumber
phoneNumberMessaging
phoneNumberVoice
$client = \Lonnylot\Telnyx\Client::getInstance('telnyx');
$client->setApiKey('<your key>');
To use with Laravel you need to set your Telnyx API key in app/config/services.php
[
'telnyx' => [
'api_key' => env('TELNYX_API_KEY', ''),
]
]
Now you can dependency inject \Lonnylot\Telnyx\Client
in your Laravel application and it will be ready to use.
To use an endpoint you simply call the endpoint from your client followed by the resource you want to use.
NOTE Keep in mind the resource mapping in the Available Resources section
$client->numberSearch->index(['filter' => ['limit' => 3, 'features' => ['sms', 'mms']]]);