Download the PHP package alexgeno/phone-verification without Composer
On this page you can find all versions of the php package alexgeno/phone-verification. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download alexgeno/phone-verification
More information about alexgeno/phone-verification
Files in alexgeno/phone-verification
Package phone-verification
Short Description An extensible and configurable php library to verify a phone
License MIT
Homepage https://github.com/alexeygeno/phone-verification-php
Informations about the package phone-verification
Phone Verification
Signing in or signing up on a modern website or mobile app typically follows these steps:
- A user initiates verification by submitting a phone number
- The user receives an SMS or a call with a one-time password (OTP)
- The user completes verification by submitting the OTP
This extensible and configurable library allows to set this up just with a few lines of code
Requirements
- Supported PHP versions: 7.4, 8.0, 8.1, 8.2
- Composer
- Any of the supported sender SDKs: twilio/sdk, messagebird/php-rest-api, vonage/client
- Any of the supported storage clients: predis/predis, mongodb/mongo-php-library
Installation
Note: All supported storage clients and sender SDKs are in require-dev section. In a production environment you must manually install only what you use.
Basic Usage
Instantiation
Predis as a storage and Twilio as a sender are used for the demonstration
There are two stages in the verification process
Initiation - a storage and a sender are required for this stage. A user submits a phone and as a result receives an otp
Completion - only a storage is required for this stage. The user submits the otp to verify the phone
That's basically it. More advanced usage including otp length customization, rate limiters, messages customization you can derive from the following sections.
Demo
Initiation
Completion
Note: See DEVELOPMENT.md as an option for how to set up a development environment
Extending
To add a new sender just create a new class
To add a new storage just create a new class
Advanced usage
Rate limit params and otp params might be customized
Initiation
Completion
Note: Of course, you can define all $config options and instantiate all classes at the same place in your code.
It is split here just to make it more clear what belongs to the initiation stage and what to the completion stage
Note: Each $config option has a default value. You should redefine only what you need.
MongoDb indexes
If you use MongoDb as a storage you may have noticed that the expiration functionality is based on indexes. They can be created automatically. It's recommended though to use this option only in a non-production environment. It's disabled by default.
Contributing
See CONTRIBUTING.md
Development
See DEVELOPMENT.md as an option for how to set up a development environment
Licence
The code for Phone Verification is distributed under the terms of the MIT license.