-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 9e674ec
Showing
17 changed files
with
862 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
indent_size = 4 | ||
indent_style = space | ||
end_of_line = lf | ||
insert_final_newline = true | ||
trim_trailing_whitespace = true | ||
|
||
[*.md] | ||
trim_trailing_whitespace = false | ||
|
||
[*.{yml,yaml}] | ||
indent_size = 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Path-based git attributes | ||
# https://www.kernel.org/pub/software/scm/git/docs/gitattributes.html | ||
|
||
# Ignore all test and documentation with "export-ignore". | ||
/.github export-ignore | ||
/.gitattributes export-ignore | ||
/.gitignore export-ignore | ||
/phpunit.xml.dist export-ignore | ||
/art export-ignore | ||
/docs export-ignore | ||
/tests export-ignore | ||
/.editorconfig export-ignore | ||
/.php_cs.dist.php export-ignore | ||
/psalm.xml export-ignore | ||
/psalm.xml.dist export-ignore | ||
/testbench.yaml export-ignore | ||
/UPGRADING.md export-ignore | ||
/phpstan.neon.dist export-ignore | ||
/phpstan-baseline.neon export-ignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
.idea | ||
.phpunit.result.cache | ||
build | ||
composer.lock | ||
coverage | ||
docs | ||
phpunit.xml | ||
phpstan.neon | ||
testbench.yaml | ||
vendor | ||
node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Changelog | ||
|
||
### v1.0 | ||
|
||
Initial release |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
The MIT License (MIT) | ||
|
||
Copyright (c) niladam <[email protected]> | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in | ||
all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,166 @@ | ||
# Laravel SendSMS integration | ||
|
||
[![Latest Version on Packagist](https://img.shields.io/packagist/v/niladam/laravel-sendsms.svg?style=flat-square)](https://packagist.org/packages/niladam/laravel-sendsms) | ||
[![GitHub Tests Action Status](https://img.shields.io/github/workflow/status/niladam/laravel-sendsms/run-tests?label=tests)](https://github.com/niladam/laravel-sendsms/actions?query=workflow%3Arun-tests+branch%3Amain) | ||
[![GitHub Code Style Action Status](https://img.shields.io/github/workflow/status/niladam/laravel-sendsms/Check%20&%20fix%20styling?label=code%20style)](https://github.com/niladam/laravel-sendsms/actions?query=workflow%3A"Check+%26+fix+styling"+branch%3Amain) | ||
[![Total Downloads](https://img.shields.io/packagist/dt/niladam/laravel-sendsms.svg?style=flat-square)](https://packagist.org/packages/niladam/laravel-sendsms) | ||
|
||
Just a small Laravel package that allows you to use [sendsms.ro](https://www.sendsms.ro/ro/) API. | ||
|
||
## Installation | ||
|
||
You can install the package via composer: | ||
|
||
```bash | ||
composer require niladam/laravel-sendsms | ||
``` | ||
|
||
You can publish the config file with: | ||
|
||
```bash | ||
php artisan vendor:publish --provider="Niladam\LaravelSendsms\LaravelSendsmsServiceProvider" --tag=config | ||
``` | ||
|
||
This is the contents of the published config file: | ||
|
||
```php | ||
<?php | ||
|
||
/** | ||
* This is the package main config file. | ||
* | ||
*/ | ||
return [ | ||
/** | ||
* This is your main username. | ||
*/ | ||
"username" => env("LARAVEL_SENDSMS_USERNAME", null), | ||
|
||
/** | ||
* This is your main password. | ||
*/ | ||
"password" => env("LARAVEL_SENDSMS_PASSWORD", null), | ||
|
||
/** | ||
* This is the base URL that the package will use. | ||
* | ||
* It has already been filled with a default value. | ||
* | ||
*/ | ||
"url" => env("LARAVEL_SENDSMS_URL", "https://api.sendsms.ro/json"), | ||
|
||
/** | ||
* If this package should have debug turned on | ||
* please set this here. | ||
* | ||
*/ | ||
"debug" => env("LARAVEL_SENDSMS_DEBUG", false), | ||
|
||
"messages" => [ | ||
"from" => env("LARAVEL_SENDSMS_FROM", null), | ||
"callback_url" => env("LARAVEL_SENDSMS_CALLBACK", null), | ||
"charset" => env("LARAVEL_SENDSMS_CHARSET", null), | ||
"coding" => env("LARAVEL_SENDSMS_CODING", null), | ||
"class" => env("LARAVEL_SENDSMS_CLASS", -1), | ||
"auto_detect_encoding" => env( | ||
"LARAVEL_SENDSMS_AUTODETECT_ENCODING", | ||
null | ||
), | ||
/** | ||
* Information on the report mask: | ||
* | ||
* 1 Delivered | ||
* 2 Undelivered | ||
* 4 Queued at network | ||
* 8 Sent to network | ||
* 16 Failed at network | ||
* | ||
* So, 19 means: | ||
* | ||
* (Delivered + Undelivered + Failed at network) | ||
* 1 + 2 + 16 = 19 | ||
*/ | ||
"report_mask" => env("LARAVEL_SENDSMS_MASK", 19) | ||
], | ||
|
||
/** | ||
* This is basically a mapping of the operations | ||
* that the API will use. | ||
* | ||
*/ | ||
"operations" => [ | ||
"balance" => "user_get_balance", | ||
"ping" => "ping", | ||
"price" => "route_check_price", | ||
"info" => "user_get_info", | ||
"number" => "user_get_phone_number", | ||
"send" => "message_send", | ||
], | ||
]; | ||
``` | ||
|
||
|
||
## Usage | ||
|
||
```php | ||
use Niladam\LaravelSendsms\SendSmsMessage; | ||
|
||
$message = SendSmsMessage::create(); | ||
|
||
$message->to('0744123123') | ||
->message('Example message here.') | ||
// You can also use the alias ->text('example text') | ||
// the following is optional, as it'll use your default settings | ||
->from('0744123456') | ||
->send(); | ||
``` | ||
|
||
OR | ||
|
||
```php | ||
use Niladam\LaravelSendsms\SendSmsMessage; | ||
|
||
SendSmsMessage::create() | ||
->to('0744123123') | ||
// You can also use the alias ->text('example text') | ||
->message('Example message here.') | ||
// the following is optional, as it'll use your default settings | ||
->from('0744123456') | ||
->send(); | ||
``` | ||
|
||
OR | ||
|
||
```php | ||
SendSmsMessage::create(to: 0744123123, message: 'Example message here')->send(); | ||
|
||
// Or by specifying the from. | ||
|
||
SendSmsMessage::create(to: '0744123123', message: 'Example message here', from: '0744123456')->send(); | ||
``` | ||
|
||
### Command | ||
```shell | ||
# The package also publishes a command with the following signature: | ||
# laravel:sendsms {to?} {message?} {from?} | ||
# so you can use it with your tinker. | ||
# | ||
php artisan laravel:sendsms | ||
# | ||
# You will be asked to provide the required details. | ||
|
||
# Or you can easily provide them yourself. | ||
php artisan laravel:sendsms "0744123123" "Example message here." "0744123456" | ||
``` | ||
|
||
## Changelog | ||
|
||
Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently. | ||
|
||
## Credits | ||
|
||
- [Madalin Tache](https://github.com/niladam) | ||
|
||
## License | ||
|
||
The MIT License (MIT). Please see [License File](LICENSE.md) for more information. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
{ | ||
"name": "niladam/laravel-sendsms", | ||
"description": "Laravel SendSMS integration", | ||
"keywords": [ | ||
"niladam", | ||
"laravel", | ||
"laravel-sendsms" | ||
], | ||
"homepage": "https://github.com/niladam/laravel-sendsms", | ||
"license": "MIT", | ||
"authors": [ | ||
{ | ||
"name": "Madalin Tache", | ||
"email": "[email protected]", | ||
"role": "Developer" | ||
} | ||
], | ||
"require": { | ||
"php": "^8.1", | ||
"illuminate/http": "^8.0|^9.0" | ||
}, | ||
"autoload": { | ||
"psr-4": { | ||
"Niladam\\LaravelSendsms\\": "src" | ||
} | ||
}, | ||
"config": { | ||
"sort-packages": true, | ||
"allow-plugins": { | ||
"pestphp/pest-plugin": true, | ||
"phpstan/extension-installer": true | ||
} | ||
}, | ||
"extra": { | ||
"laravel": { | ||
"providers": [ | ||
"Niladam\\LaravelSendsms\\LaravelSendsmsServiceProvider" | ||
], | ||
"aliases": { | ||
"LaravelSendsms": "Niladam\\LaravelSendsms\\Facades\\LaravelSendsms", | ||
"SendSmsMessage": "Niladam\\LaravelSendsms\\SendSmsMessage\\" | ||
} | ||
} | ||
}, | ||
"minimum-stability": "dev", | ||
"prefer-stable": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
<?php | ||
|
||
/** | ||
* This is the package main config file. | ||
*/ | ||
return [ | ||
/** | ||
* This is your main username. | ||
*/ | ||
'username' => env('LARAVEL_SENDSMS_USERNAME', null), | ||
|
||
/** | ||
* This is your main password. | ||
*/ | ||
'password' => env('LARAVEL_SENDSMS_PASSWORD', null), | ||
|
||
/** | ||
* This is the base URL that the package will use. | ||
* | ||
* It has already been filled with a default value. | ||
*/ | ||
'url' => env('LARAVEL_SENDSMS_URL', 'https://api.sendsms.ro/json'), | ||
|
||
/** | ||
* If this package should have debug turned on | ||
* please set this here. | ||
*/ | ||
'debug' => env('LARAVEL_SENDSMS_DEBUG', false), | ||
|
||
'messages' => [ | ||
'from' => env('LARAVEL_SENDSMS_FROM', null), | ||
'callback_url' => env('LARAVEL_SENDSMS_CALLBACK', null), | ||
'charset' => env('LARAVEL_SENDSMS_CHARSET', null), | ||
'coding' => env('LARAVEL_SENDSMS_CODING', null), | ||
'class' => env('LARAVEL_SENDSMS_CLASS', -1), | ||
'auto_detect_encoding' => env( | ||
'LARAVEL_SENDSMS_AUTODETECT_ENCODING', | ||
null | ||
), | ||
/** | ||
* Information on the report mask: | ||
* | ||
* 1 Delivered | ||
* 2 Undelivered | ||
* 4 Queued at network | ||
* 8 Sent to network | ||
* 16 Failed at network | ||
* | ||
* So, 19 means: | ||
* | ||
* (Delivered + Undelivered + Failed at network) | ||
* 1 + 2 + 16 = 19 | ||
*/ | ||
'report_mask' => env('LARAVEL_SENDSMS_MASK', 19), | ||
], | ||
|
||
/** | ||
* This is basically a mapping of the operations | ||
* that the API will use. | ||
*/ | ||
'operations' => [ | ||
'balance' => 'user_get_balance', | ||
'ping' => 'ping', | ||
'price' => 'route_check_price', | ||
'info' => 'user_get_info', | ||
'number' => 'user_get_phone_number', | ||
'send' => 'message_send', | ||
], | ||
]; |
Oops, something went wrong.