PHPackages                             oza75/laravel-orange-sms-channel - 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. oza75/laravel-orange-sms-channel

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

oza75/laravel-orange-sms-channel
================================

A laravel notification channel to deliver sms using the Orange SMS Api

v0.0.4(3y ago)1040.8k—5.3%3[1 issues](https://github.com/oza75/laravel-orange-sms-channel/issues)MITPHPPHP ^7.4|^8.0

Since Jun 18Pushed 3y ago1 watchersCompare

[ Source](https://github.com/oza75/laravel-orange-sms-channel)[ Packagist](https://packagist.org/packages/oza75/laravel-orange-sms-channel)[ Docs](https://github.com/oza75/laravel-orange-sms-channel)[ RSS](/packages/oza75-laravel-orange-sms-channel/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (4)Versions (5)Used By (0)

Laravel Orange SMS notification channel
=======================================

[](#laravel-orange-sms-notification-channel)

[![Latest Version on Packagist](https://camo.githubusercontent.com/40874aef2f13d9e1e6744184957379015931da9eb38ff6ce67e0c10e0d67e825/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6f7a6137352f6c61726176656c2d6f72616e67652d736d732d6368616e6e656c2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/oza75/laravel-orange-sms-channel)[![Total Downloads](https://camo.githubusercontent.com/00f1d7efea7272efcbc518699f447af3c0507721d42a00b4f511c52ad346102a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6f7a6137352f6c61726176656c2d6f72616e67652d736d732d6368616e6e656c2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/oza75/laravel-orange-sms-channel)[![GitHub Actions](https://github.com/oza75/laravel-orange-sms-channel/actions/workflows/main.yml/badge.svg)](https://github.com/oza75/laravel-orange-sms-channel/actions/workflows/main.yml/badge.svg)

A Laravel Notification Channel to send sms notification to your users in the Middle East and Africa using Orange SMS. More details here .

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

[](#installation)

You can install the package via composer:

```
composer require oza75/laravel-orange-sms-channel
```

You can publish configuration file using:

```
php  artisan vendor:publish --provider="Oza75\OrangeSMSChannel\OrangeSMSServiceProvider"
```

Usage
-----

[](#usage)

First, you need to create an application on orange developer website. Go to  and create a new application. Once you created your application, you will get a `Client ID` and `Client Secret`. These credentials will be used to communicate with Orange API. Now, you need to add the Orange SMS API to your application. Go to  select your country and then click to the `Use this API` button.

Finally, add a new service in your `config/service.php` file.

```
// file: config/services.php

return [
    // ...others services

    'orange' => [
        'client_id' => env('ORANGE_CLIENT_ID'),
        'client_secret' => env('ORANGE_CLIENT_SECRET'),
    ]
];
```

### Configure your notification

[](#configure-your-notification)

In your notification class, add the orange SMS Channel in the via method and create a `toOrange` method.

```
use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Notification;
use Oza75\OrangeSMSChannel\OrangeMessage;
use Oza75\OrangeSMSChannel\OrangeSMSChannel;

class ConfirmationNotification extends Notification
{
    use Queueable;

    /**
     * Get the notification's delivery channels.
     *
     * @param mixed $notifiable
     * @return array
     */
    public function via($notifiable)
    {
        return [OrangeSMSChannel::class];
    }

    // ...others method here

     /**
     * Send sms using Orange API
     *
     * @param mixed $notifiable
     * @return OrangeMessage
     */
    public function toOrange($notifiable):OrangeMessage
    {
        return (new OrangeMessage())
                ->to('+22600000000')
                ->from('+22600000000')
                ->text('Sample text');
    }
}
```

### Available Message methods

[](#available-message-methods)

- `to` (the receiver phone number)
- `from` (the sender phone number)
- `text` (the actual text message)

### Configuration file

[](#configuration-file)

```
