lonnylot / telnyx-php-sdk
Telnex PHP SDK
Requires
- lonnylot/crud-sugar: ^1.0
Requires (Dev)
- phpunit/phpunit: ^8.4
- ramsey/uuid: ^3.9
This package is auto-updated.
Last update: 2025-02-22 00:07:11 UTC
README
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.
Installation
Composer
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');
Dependencies
The library requires the CrudSugar library.
Getting Started
This library was made so you can interact with the Telnyx APIs.
Table of Contents
Available Resources
The resources are named as follows:
index
- Telnyx "List"show
- Telnyx "Retrieve"update
- Telnyx "Update"delete
- Telnyx "Delete"store
- Telnyx "Create"
Available Endpoints
messagingProfile
numberOrder
numberSearch
phoneNumber
phoneNumberMessaging
phoneNumberVoice
Setup Client
Non Laravel
$client = \Lonnylot\Telnyx\Client::getInstance('telnyx'); $client->setApiKey('<your key>');
Laravel
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.
Use Endpoint
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']]]);