Skip to content

Commit 26b7942

Browse files
committed
Add .gitattributes
Spelling and grammar fixes for Readme.md Composer.json is ready for prod
1 parent f0d62b3 commit 26b7942

File tree

4 files changed

+69
-49
lines changed

4 files changed

+69
-49
lines changed

.gitatttributes

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
.github export-ignore
2+
tests export-ignore
3+
phpunit.xml export-ignore
4+
.gitattributes export-ignore
5+
.gitignore export-ignore
6+
phpstan.neon.dist export-ignore

README.md

Lines changed: 34 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,37 @@
1-
# Phone Verification Laravel #
1+
# Phone Verification via [Laravel Notification Channels](https://laravel-notification-channels.com/)
22

3-
The usual way to sign in/sign up on a modern website or mobile app is:
4-
- A user initiates verification submitting a phone number
5-
- The user receives an sms or a call with an [ otp](https://en.wikipedia.org/wiki/One-time_password)
6-
- The user completes verification submitting the [ otp](https://en.wikipedia.org/wiki/One-time_password)
3+
[![Build Status](https://github.com/alexeygeno/phone-verification-laravel/workflows/tests/badge.svg)](https://github.com/alexeygeno/phone-verification-laravel/actions)
4+
[![Build Status](https://github.com/alexeygeno/phone-verification-laravel/workflows/pint/badge.svg)](https://github.com/alexeygeno/phone-verification-php/actions)
5+
[![Coverage Status](https://coveralls.io/repos/github/alexeygeno/phone-verification-laravel/badge.svg)](https://coveralls.io/github/alexeygeno/phone-verification-laravel)
76

8-
This library is built on top of [ alexeygeno/phone-verification-php ](https://github.com/alexeygeno/phone-verification-php) allows to set this up.
97

10-
Among supported features:
11-
- Easy(.env) switching between different storages and notification channels
12-
- Configurable length and expiration time for OTP
8+
Signing in or signing up on a modern website or mobile app typically follows these steps:
9+
- A user initiates verification by submitting a phone number
10+
- The user receives an SMS or a call with a one-time password [(OTP)](https://en.wikipedia.org/wiki/One-time_password)
11+
- The user completes verification by submitting the [OTP](https://en.wikipedia.org/wiki/One-time_password)
12+
13+
This library is built on top of [ alexeygeno/phone-verification-php ](https://github.com/alexeygeno/phone-verification-php) and allows to set this up
14+
15+
Supported features:
16+
- Easy(**.env**) switching between different storages and notification channels
17+
- Configurable length and expiration time for [OTP](https://en.wikipedia.org/wiki/One-time_password)
1318
- Configurable rate limits
1419
- Localization
15-
- Logging notifications instead of sending the real ones. Useful for non-production environments
16-
- Usage with different Laravel approaches: [ Automatic injection ](https://laravel.com/docs/10.x/container#automatic-injection), [ facade ](https://laravel.com/docs/10.x/facades), [ commands ](https://laravel.com/docs/10.x/artisan#writing-commands)
17-
- Routes out of the box for the quick start
20+
- Usage with different Laravel approaches: [automatic injection](https://laravel.com/docs/9.x/container#automatic-injection), [facade](https://laravel.com/docs/9.x/facades), and [commands](https://laravel.com/docs/9.x/artisan#writing-commands)
21+
- Logging notifications instead of sending real ones, beneficial for non-production environments
22+
- Out-of-the-box routes for quick start
1823

1924
## Requirements
20-
Laravel 9.x
25+
[Laravel 9.x](https://laravel.com/docs/9.x)
2126

22-
One of the Laravel notification channels: [ vonage ](https://github.com/laravel/vonage-notification-channel), [ twilio ](https://github.com/laravel-notification-channels/twilio), [ messagebird ](https://github.com/laravel-notification-channels/messagebird) and [many more ](https://github.com/laravel-notification-channels?q=&type=all&language=php&sort=)
27+
One of Laravel notification channels: [vonage](https://github.com/laravel/vonage-notification-channel), [twilio](https://github.com/laravel-notification-channels/twilio), [messagebird](https://github.com/laravel-notification-channels/messagebird) and [many more ](https://github.com/laravel-notification-channels?q=&type=all&language=php&sort=)
2328

24-
One of the supported storages: [ predis/predis ](https://github.com/predis/predis), [ jenssegers/laravel-mongodb ](https://github.com/jenssegers/laravel-mongodb)
29+
One of the supported storages: [predis/predis](https://github.com/predis/predis), [jenssegers/laravel-mongodb](https://github.com/jenssegers/laravel-mongodb)
2530
## Installation
2631
```shell
2732
composer require alexgeno/phone-verification-laravel predis/predis laravel/vonage-notification-channel
2833
```
29-
**Note:** redis as a storage and vonage as a notification channel are defaults in config
34+
**Note:** Redis as a storage and Vonage as a notification channel are defaults in the configuration
3035

3136
## Usage
3237
#### Automatic injection
@@ -44,14 +49,10 @@ public function complete(\AlexGeno\PhoneVerification\Manager\Completer $manager)
4449
```
4550
#### Facade
4651
```php
47-
use \AlexGeno\PhoneVerificationLaravel\Facades\PhoneVerification;
48-
49-
PhoneVerification::initiate('+15417543010');
52+
\AlexGeno\PhoneVerificationLaravel\Facades\PhoneVerification::initiate('+15417543010');
5053
```
5154
```php
52-
use \AlexGeno\PhoneVerificationLaravel\Facades\PhoneVerification;
53-
54-
PhoneVerification::complete('+15417543010', 1234);
55+
\AlexGeno\PhoneVerificationLaravel\Facades\PhoneVerification::complete('+15417543010', 1234);
5556
```
5657
#### Commands
5758
```shell
@@ -62,38 +63,35 @@ php artisan phone-verification:complete --to=+15417543010 --otp=1234
6263
```
6364
#### Routes
6465
```shell
65-
curl -d "to=+380935259282" http://localhost/phone-verification/initiate
66+
curl -d "to=+380935259282" localhost/phone-verification/initiate
6667
#{"ok":true,"message":"Sms has been sent. Check your Phone!"}
6768
```
6869
```shell
69-
curl -d "to=+380935259282&otp=1234" http://localhost/phone-verification/complete
70+
curl -d "to=+380935259282&otp=1234" localhost/phone-verification/complete
7071
#{"ok":true,"message":"The verification is done!"}
7172
```
72-
**Note**: The package routes are available by default. To make them unavailable without redefining the service provider just change the bool key **phone-verification.sender.to_log** in config
73+
**Note**: The package routes are available by default. To make them unavailable without redefining the service provider, change the bool key **phone-verification.sender.to_log** in the configuration
7374

7475
## Different storages and notification channels
75-
To switch between [ available ](#Requirements) storages and notifications channels you need only to install the respective package and change .env.
76+
To switch between [available](#requirements) storages and notifications channels, install the respective package and update the **.env** file
7677

77-
For instance if you need **mongodb** as a storage and **twilio** as a notification channel just do this:
78+
For example, to use **Mongodb** as a storage and **Twilio** as a notification channel:
7879
```shell
7980
composer require jenssegers/laravel-mongodb laravel-notification-channels/twilio
8081
```
8182
```dotenv
8283
PHONE_VERIFICATION_SENDER=twilio
8384
PHONE_VERIFICATION_STORAGE=mongodb
8485
```
85-
If what's available is not enough you can redefine the service provider and add a storage (implementing *\AlexGeno\PhoneVerification\Storage\I*) or/and a sender (implementing \AlexGeno\PhoneVerification\Sender\I)
86-
87-
88-
86+
If the available options are not sufficient, you can redefine the service provider and add a custom storage (implementing **\AlexGeno\PhoneVerification\Storage\I**) or/and a sender (implementing **\AlexGeno\PhoneVerification\Sender\I**)
8987
## Configuration
9088
```php
9189
[
9290
'storage' => [
9391
'driver' => env('PHONE_VERIFICATION_STORAGE', 'redis'), // redis || mongodb
9492
'redis' => [
9593
'connection' => 'default',
96-
// keys settings - normally you don't need to change it
94+
// the key settings - normally you don't need to change them
9795
'settings' => [
9896
'prefix' => 'pv:1',
9997
'session_key' => 'session',
@@ -102,7 +100,7 @@ If what's available is not enough you can redefine the service provider and add
102100
],
103101
'mongodb' => [
104102
'connection' => 'mongodb',
105-
// collections settings - normally you don't need to change it
103+
// the collection settings - normally you don't need to change them
106104
'settings' => [
107105
'collection_session' => 'session',
108106
'collection_session_counter' => 'session_counter',
@@ -122,17 +120,15 @@ If what's available is not enough you can redefine the service provider and add
122120
'period_secs' => 86400,
123121
'count' => 10,
124122
],
125-
'complete' => [ // for every 'to' no more than 5 failed completion over 5 minutes
126-
'period_secs' => 300, // this is also the expiration period for an otp
123+
'complete' => [ // for every 'to' no more than 5 failed completions over 5 minutes
124+
'period_secs' => 300, // this is also the expiration period for OTP
127125
'count' => 5,
128126
],
129127
],
130128
],
131129
];
132-
133130
```
134131

135-
136132
## Publishing
137133
#### Config
138134
```shell
@@ -146,7 +142,7 @@ php artisan vendor:publish --tag=phone-verification-lang
146142
```shell
147143
php artisan vendor:publish --tag=phone-verification-migrations
148144
```
149-
**Note**: Only the mongodb storage driver needs migrations
145+
**Note**: Only the **MongoDB** storage driver requires migrations
150146

151147

152148

composer.json

Lines changed: 27 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,21 @@
11
{
22
"name": "alexgeno/phone-verification-laravel",
3-
"description":"An extensible and configurable php library to verify a phone",
3+
"description":"A Laravel library to verify a phone via notification channels. Any notification channel can be used as a sender. Redis(predis) or MongoDb can be used a storage.",
44
"type": "library",
5+
"keywords":["otp","phone", "verification", "verify", "sms", "call", "2fa", "2factor","authentication", "signin",
6+
"signup", "redis", "mongo", "mongodb", "verify-by-phone", "otp", "notification", "notification-channel",
7+
"twilio", "messagebird", "vonage", "touch-sms", "clickatell", "jusibe", "smsc-ru", "authy", "cmsms", "46elks",
8+
"sipgate", "all-my-sms", "smspoh", "turbosms", "vodafone", "africastalking", "sms77", "smsapi", "sms-broadcast"
9+
],
510
"license": "MIT",
11+
"authors": [
12+
{
13+
"name": "Alexey Geno",
14+
"email": "[email protected]",
15+
"homepage":"https://github.com/alexeygeno"
16+
}
17+
],
18+
"homepage": "https://github.com/alexeygeno/phone-verification-laravel",
619
"autoload": {
720
"psr-4": {
821
"AlexGeno\\PhoneVerificationLaravel\\": "src/"
@@ -20,17 +33,17 @@
2033
]
2134
}
2235
},
23-
"authors": [
24-
{
25-
"name": "Alexey Geno",
26-
"email": "[email protected]",
27-
"homepage":"https://github.com/alexeygeno"
28-
}
29-
],
3036
"require": {
3137
"php":"^8.0",
3238
"alexgeno/phone-verification": "^1.0"
3339
},
40+
"suggest": {
41+
"predis/predis": "required to use Redis as a storage",
42+
"enssegers/mongodb": "required to use MongoDB as a storage",
43+
"laravel-notification-channels/messagebird": "required to use Messagebird as a sender's notification channel",
44+
"laravel-notification-channels/twilio": "required to use Twilio as a sender's notification channel",
45+
"laravel/vonage-notification-channel": "required to use Vonage as a sender's notification channel"
46+
},
3447
"require-dev": {
3548
"jenssegers/mongodb": "^3.9",
3649
"predis/predis": "^2.2",
@@ -43,5 +56,10 @@
4356
"nunomaduro/collision": "^6.2",
4457
"laravel/pint": "^1.5",
4558
"phpstan/phpstan": "^1.10"
46-
}
59+
},
60+
"config": {
61+
"sort-packages": true
62+
},
63+
"minimum-stability": "dev",
64+
"prefer-stable": true
4765
}

config/phone-verification.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@
3434
'period_secs' => 86400,
3535
'count' => 10,
3636
],
37-
'complete' => [ // for every 'to' no more than 5 failed completion over 5 minutes
38-
'period_secs' => 300, // this is also the expiration period for otp
37+
'complete' => [ // for every 'to' no more than 5 failed completions over 5 minutes
38+
'period_secs' => 300, // this is also the expiration period for OTP
3939
'count' => 5,
4040
],
4141
],

0 commit comments

Comments
 (0)