Skip to content
This repository was archived by the owner on Dec 18, 2023. It is now read-only.

Commit 5c8ec3a

Browse files
committed
namespace and document changes
1 parent 9755306 commit 5c8ec3a

2 files changed

Lines changed: 26 additions & 68 deletions

File tree

README.md

Lines changed: 18 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
1-
# Mobtexting notifications channel for Laravel 5.3+
1+
# Mobtexting php api lib
22

3-
This package makes it easy to send [Mobtexting notifications](https://mobtexting.com) with Laravel 5.3.
3+
This package makes it easy to send [Mobtexting notifications](https://mobtexting.com).
44

55
## Contents
66

77
- [Installation](#installation)
8-
- [Setting up your Mobtexting account](#setting-up-your-twilio-account)
98
- [Usage](#usage)
10-
- [Available Message methods](#available-message-methods)
119
- [Changelog](#changelog)
1210
- [Testing](#testing)
1311
- [Security](#security)
@@ -20,76 +18,30 @@ This package makes it easy to send [Mobtexting notifications](https://mobtexting
2018
You can install the package via composer:
2119

2220
``` bash
23-
composer require mobtexting/laravel
24-
```
25-
26-
Add the service provider (only required on Laravel 5.4 or lower):
27-
28-
```php
29-
// config/app.php
30-
'providers' => [
31-
...
32-
NotificationChannels\Mobtexting\MobtextingProvider::class,
33-
],
34-
```
35-
36-
### Setting up your Mobtexting account
37-
38-
Add your Mobtexting Auth Token, and From Number (optional) to your `config/services.php`:
39-
40-
```php
41-
// config/services.php
42-
...
43-
'mobtexting' => [
44-
'username' => env('MOBTEXTING_USERNAME'), // optional when using auth token
45-
'password' => env('MOBTEXTING_PASSWORD'), // optional when using auth token
46-
'token' => env('MOBTEXTING_AUTH_TOKEN'), // optional when using username and password
47-
'from' => env('TWILIO_FROM'), // optional
48-
],
49-
...
21+
composer require mobtexting/mobtexting-php
5022
```
5123

5224
## Usage
5325

54-
Now you can use the channel in your `via()` method inside the notification:
55-
56-
``` php
57-
use NotificationChannels\Mobtexting\MobtextingChannel;
58-
use NotificationChannels\Mobtexting\MobtextingSmsMessage;
59-
use Illuminate\Notifications\Notification;
60-
61-
class AccountApproved extends Notification
62-
{
63-
public function via($notifiable)
64-
{
65-
return [MobtextingChannel::class];
66-
}
67-
68-
public function toMobtexting($notifiable)
69-
{
70-
return (new MobtextingSmsMessage())
71-
->text("Your {$notifiable->service} account was approved!");
72-
}
73-
}
74-
```
75-
76-
In order to let your Notification know which phone are you sending/calling to, the channel will look for the `phone_number` attribute of the Notifiable model. If you want to override this behaviour, add the `routeNotificationForMobtexting` method to your Notifiable model.
26+
### Send an SMS
7727

7828
```php
79-
public function routeNotificationForMobtexting()
80-
{
81-
return '+1234567890';
82-
}
29+
// Send an SMS using Twilio's REST API and PHP
30+
<?php
31+
$token = "YYYYYY"; // Your Auth Token from www.twilio.com/console
32+
33+
$client = new Mobtexting\Client($token);
34+
$message = $client->messages->send(
35+
'1234567890', // Text this number
36+
array(
37+
'from' => '9991231234', // From a valid Twilio number
38+
'text' => 'Hello from Twilio!'
39+
)
40+
);
41+
42+
print_r($message->json());
8343
```
8444

85-
### Available Message methods
86-
87-
#### MobtextingSmsMessage
88-
89-
- `from('')`: Accepts a phone to use as the notification sender.
90-
- `text('')`: Accepts a string value for the notification body.
91-
- `to('')`: Accepts a string value for the notification to (over writes default).
92-
9345
## Testing
9446

9547
``` bash

composer.json

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
11
{
2-
"name": "mobtexting/mobtexting-php",
2+
"name": "mobtexting/sdk",
33
"description": "A boilerplate for contributions.",
4-
"homepage": "https://github.com/mobtexting/mobtexting-laravel",
4+
"homepage": "https://github.com/mobtexting/mobtexting-php",
55
"license": "MIT",
6+
"authors": [
7+
{
8+
"name": "Sankar Suda",
9+
"email": "sankar@mobtexting.com"
10+
}
11+
],
612
"require": {
713
"php": ">=5.6",
814
"mobtexting/message-sdk": "dev-master"

0 commit comments

Comments
 (0)