1. Go to this page and download the library: Download waltersilvacruz/secorphp 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/ */
...
use Secorphp;
class MeuController extends Controller {
public function index() {
// verifica acesso do usuário que está logado ao recurso
if(Secorphp::allow('USUARIO') {
// tem acesso ao recurso "USUARIO"...
}
// verifica acesso do usuário que está logado à uma ação
if(Secorphp::allow('USUARIO', 'PODE_EDITAR') {
// tem acesso à ação "EDITAR" no recurso "USUARIO" ...
}
}
}
...
use Secorphp;
class MeuController extends Controller {
public function index() {
// ou utilize o método user()
if(Secorphp::user('mary')->allow('USUARIO') {
// Mary tem acesso ao recurso "USUARIO"...
}
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.