Download the PHP package it-devgroup/laravel-activation-code without Composer
On this page you can find all versions of the php package it-devgroup/laravel-activation-code. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download it-devgroup/laravel-activation-code
More information about it-devgroup/laravel-activation-code
Files in it-devgroup/laravel-activation-code
Package laravel-activation-code
Short Description laravel activation codes
License MIT
Informations about the package laravel-activation-code
Install for Lumen
1. Open file bootstrap/app.php
and add new service provider
Uncommented strings
Added after $app->configure('app');
2. Run commands
For creating config file
For creating migration file
For generate table
Install for laravel
1. Open file config/app.php and search
Add to section
Example
2. Run commands
For creating config file
For creating migration file
For generate table
ENV variables
File .env
Total of attempt for enter code
Total of attempt for enter code (for sms mode)
Generate code mode
Generate code mode (for sms mode)
Code length
Code length (for sms mode)
Code TTL
Code TTL (for sms mode)
Custom model
Step 1
Create custom model for activation code
Example:
File: app/CustomFile.php
Content:
If need change table name or need added other code:
Step 2
Open config/activation_code.php and change parameter "model", example:
Usage
Initialize service
or injected
further we will use the variable $service
Generation code
Returned \ItDevgroup\LaravelActivationCode\Model\ActivationCode eloquent model
Basic usage with min parameters
Usage with parameter
Check activation code on of valid
Returned \ItDevgroup\LaravelActivationCode\Model\ActivationCode eloquent model
If returned model, then code valid
or
Delete activation code
Use if you need to activate the code or just delete it
Configuring activation code
All configuration is optional depending on the task
Example
- setMode - code generation mode (null - use default configuration, sms - use configuration for sms mode) (only works for configurations that have not been manually overridden)
- setGenerateCodeMode - rule of generation code
-
- ItDevgroup\LaravelActivationCode\ActivationCodeServiceInterface::GENERATE_CODE_MODE_ALPHABET (1) - only letters, case insensitive
-
- ItDevgroup\LaravelActivationCode\ActivationCodeServiceInterface::GENERATE_CODE_MODE_ALPHABET_LOWER (2) - only lowercase letters
-
- ItDevgroup\LaravelActivationCode\ActivationCodeServiceInterface::GENERATE_CODE_MODE_ALPHABET_UPPER (3) - only uppercase letters
-
- ItDevgroup\LaravelActivationCode\ActivationCodeServiceInterface::GENERATE_CODE_MODE_NUMBER (4) - only numbers
-
- ItDevgroup\LaravelActivationCode\ActivationCodeServiceInterface::GENERATE_CODE_MODE_ALL (5) - (default) letters and numbers
- setCodeLength - code length
- setCodeTTL - code lifetime, format: 10m (example: 10 - 10 seconds, 10m - 10 minutes, 10h - 10 hours, 10d - 10 days)
- setMaxAttempt - maximum number of attempts to enter the code (use when checking code)
Reset configuration
- mode
- generationCode
- code length
- code ttl
- max attempt
Example
With custom configuration
All versions of laravel-activation-code with dependencies
illuminate/support Version ^9.0|^10.0
illuminate/database Version ^9.0|^10.0
illuminate/collections Version ^9.0|^10.0