PHP code example of teknasyon / phalconphp-auth
1. Go to this page and download the library: Download teknasyon/phalconphp-auth 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/ */
teknasyon / phalconphp-auth example snippets
$credentials = ['username' => 'ilyas', 'password' => '12345'];
$result = $di->auth->attempt($credentials); // returns true on success, false on failure.
var_dump($di->auth->check()) // dumps true if a user is logged in. False otherwise.
$di->auth->logout();
$user = Users::findFirstById(1);
$di->auth->login($user); //
var_dump($di->auth->check()) // outputs true.
var_dump($di->auth->user()) // dumps the logged in user.