PHP code example of beliven-it / laravel-password-expiry

1. Go to this page and download the library: Download beliven-it/laravel-password-expiry library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

beliven-it / laravel-password-expiry example snippets



// config for Beliven/PasswordExpiry
return [
    'days_to_notify_expiration' => (int) env('DAYS_TO_NOTIFY_EXPIRATION', 7),
    'days_to_expire'            => (int) env('DAYS_TO_EXPIRE', 90),
];



namespace App\Models;

use Beliven\PasswordExpiry\Traits\HasPasswordExpiration;

class User extends Authenticatable
{
    use HasPasswordExpiration;
    // ... other code
}



$user->password = $password_from_request;
$user->save();

// This action create a new record in the model_password_changes table



$user->password_expires_at;




$user->tryClearPassword();




$schedule->command('password-expiry:check')->daily();




use Beliven\PasswordExpiry\Facades\PasswordExpiry;

PasswordExpiry::checkPasswords();
bash
php artisan vendor:publish --tag="password-expiry-migrations"
php artisan migrate
bash
php artisan vendor:publish --tag="password-expiry-config"
bash

php artisan password-expiry:check