mocean / laravel-mocean
Mocean API for Laravel
4.0.0
2024-06-25 16:28 UTC
Requires
- php: >=8.2
- illuminate/support: ~9||~10||~11
- mocean/client7: ^2.0.0
Requires (Dev)
- illuminate/console: ~9||~10||~11
- orchestra/testbench: ~3.0||~4.0||~5.0||~6.0||~7.0||~8.0||~9.0 |~10.0
- phpunit/phpunit: ~6.0||~7.0||~8.0||~9.0
This package is auto-updated.
Last update: 2024-12-25 17:37:25 UTC
README
Installation
To install the library, run this command in terminal:
composer require mocean/laravel-mocean
Laravel 5.5
You don't have to do anything else, this package autoloads the Service Provider and create the Alias, using the new Auto-Discovery feature.
Laravel 5.4 and below
Add the Service Provider and Facade alias to your config/app.php
'providers' => [ Mocean\Laravel\MoceanServiceProvider::class, ] 'aliases' => [ 'Mocean' => Mocean\Laravel\Facade\Facade::class, ]
Publish the config file
php artisan vendor:publish --provider="Mocean\Laravel\MoceanServiceProvider"
Usage
Creating a Mocean object
//use configured mocean setting from Laravel IOC Container $mocean = app('mocean');
Send a text message
$mocean->message()->send([ 'mocean-to' => '60123456789', 'mocean-from' => 'MOCEAN', 'mocean-text' => 'Hello World' ]);
If you have multiple account defined in config
$mocean->using('second_account')->message()->send(...); $mocean->using('third_account')->message()->send(...);
or use credential programmatically
//by \Mocean\Client\Credentials\Basic class $mocean->using( new \Mocean\Client\Credentials\Basic('mocean_api_key', 'mocean_api_secret') )->message()->send(...); //by using array $mocean->using([ 'MOCEAN_API_KEY' => 'mocean_api_key', 'MOCEAN_API_SECRET' => 'mocean_api_secret' ])->message()->send(...);
Using Facade
Facade auto configured using the config file, make sure u publish the config file.
Include this facade
use Mocean; Mocean::message()->send(...); Mocean::using(...)->message(...);
then u can statically call all function defined in the sdk. Look Usage for more usage info.
License
Laravel Mocean is licensed under the MIT License