PHPackages                             agiledrop/laravel-telnyx - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Mail &amp; Notifications](/categories/mail)
4. /
5. agiledrop/laravel-telnyx

ActiveLibrary[Mail &amp; Notifications](/categories/mail)

agiledrop/laravel-telnyx
========================

Telnyx SMS service Notification Channel for Laravel.

1.0.1(4y ago)184.8k↓50%6[1 PRs](https://github.com/AGILEDROP/laravel-telnyx/pulls)MITPHPPHP ^7.4|^8.0

Since Nov 17Pushed 3y ago3 watchersCompare

[ Source](https://github.com/AGILEDROP/laravel-telnyx)[ Packagist](https://packagist.org/packages/agiledrop/laravel-telnyx)[ Docs](https://github.com/agiledrop/laravel-telnyx)[ GitHub Sponsors](https://github.com/sponsors/spatie)[ Fund](https://spatie.be/open-source/support-us)[ RSS](/packages/agiledrop-laravel-telnyx/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)Dependencies (7)Versions (5)Used By (0)

Laravel Telnyx Driver
=====================

[](#laravel-telnyx-driver)

[![Latest Version on Packagist](https://camo.githubusercontent.com/3a5ed09feb8290a6ff3285d5d7b1cb03de0daff43a0cfc20a94659bc1438f5b8/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6167696c6564726f702f6c61726176656c2d74656c6e79782e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/agiledrop/laravel-telnyx)[![GitHub Tests Action Status](https://camo.githubusercontent.com/bf5d9856c198fdb05bb60673c77fccc7f786ee0e5dc19ea64ea77415823e765f/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f6167696c6564726f702f6c61726176656c2d74656c6e79782f54657374733f6c6162656c3d7465737473)](https://github.com/agiledrop/laravel-telnyx/actions?query=workflow%Tests+branch%3Amaster)[![Total Downloads](https://camo.githubusercontent.com/128c40227a95065f348f2e167e12c626cb0f46d98668e21fee9f9bfdf82c556f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6167696c6564726f702f6c61726176656c2d74656c6e79782e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/agiledrop/laravel-telnyx)

This package enables to send SMS and MMS notifications from your Laravel application.

Requires Laravel 7+

Prerequisites
-------------

[](#prerequisites)

You first need to register a [Telnyx](https://telnyx.com/) account, generate a **phone number** a **messaging profile**, and an **API key**.

Notice that at the moment just American phone numbers are allowed to send SMS, so you will need to generate an American number.

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require agiledrop/laravel-telnyx
```

You should publish and run the migrations with:

```
php artisan vendor:publish --provider="AGILEDROP\LaravelTelnyx\LaravelTelnyxServiceProvider" --tag="migrations"
php artisan migrate
```

You should publish the config file with:

```
php artisan vendor:publish --provider="AGILEDROP\LaravelTelnyx\LaravelTelnyxServiceProvider" --tag="config"
```

This is the contents of the published config file:

```
return [

    /*
     * The API KEY.
     *
     * You can generate API keys from the Telnyx web interface.
     * See https://developers.telnyx.com/docs/v2/development/authentication for details
     */
    'api_key' => env('TELNYX_API_KEY'),

    /*
     * The phone number or a text that is shown as sender
     *
     */
    'from' => env('TELNYX_FROM'), // Can be phone number or name

    /*
     * The messaging profile id.
     * Also generated from the Telnyx web interface.
     */
	'messaging_profile_id' => env('TELNYX_MESSAGING_PROFILE_ID'),
];
```

You should then add you your .env file the following variables with your parameters:

```
TELNYX_API_KEY=
TELNYX_FROM=
TELNYX_MESSAGING_PROFILE_ID=

```

Usage
-----

[](#usage)

In your Laravel Notification you just need to

- Specify the notification channel
- import the class and implement the toTelnyx() method.

Sending an SMS notification
---------------------------

[](#sending-an-sms-notification)

This is an example of SMS notification.

### Create a notification

[](#create-a-notification)

Generate a notification with an artisan command:

```
php artisan make:notification SmsNotification

```

This will create for you the file at `app/Notifications/SmsNotification.php`

Then paste in that the following code:

```
