Sample Console App demonstrating Telnyx-PHP Available number Searching
The full documentation and tutorial is available on developers.telnyx.com
You will need to set up:
- Telnyx Account
- PHP & Composer installed
- Search by areacode or NPA and get a list of response
The following environmental variables need to be set
Variable | Description |
---|---|
TELNYX_API_KEY |
Your Telnyx API Key |
TELNYX_PUBLIC_KEY |
Your Telnyx Public Key |
TELNYX_APP_PORT |
Defaults to 8000 The port the app will be served (if applicable) |
This app uses the excellent phpenv package to manage environment variables.
Make a copy of .env.sample
and save as .env
and update the variables to match your creds.
TELNYX_API_KEY=
TELNYX_PUBLIC_KEY=
TENYX_APP_PORT=8000
Run the following commands to get started
$ git clone https://github.com/d-telnyx/demo-php-telnyx.git
$ cd console-number-search
$ composer install
Run the PHP script php app.php
from the command line and answer the prompt for area code / NPA
$ php app.php
Which NPA (area code) would you like to get NXX counts?: 919
Array
(
[335] => 2
[646] => 5
[887] => 6
[944] => 2
)