1. Go to this page and download the library: Download psecio/invoke 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/ */
psecio / invoke example snippets
$en = new \Psecio\Invoke\Enforcer(__DIR__.'/config/routes.yml');
$allowed = $en->isAuthorized(
new InvokeUser(array('username' => 'ccornutt')),
new \Psecio\Invoke\Resource()
);
if ($allowed === true) {
echo 'Good to go!';
}
class MyGroup implements \Psecio\Invoke\GroupInterface { }
class MyUser implements \Psecio\Invoke\UserInterface
{
public function getGroups()
{
return [ new MyGroup(), new MyGroup() ];
}
}
$config = array('/event/view/([0-9]+)');
$uri = '/event/view/1234';
$matcher = new \Psecio\Invoke\Match\Route\Regex($config);
if ($matcher->evaluate($uri) === true) {
$params = $matcher->getParmas();
}
namespace App;
class MyUser
{
public static checkAccess($data)
{
$result = false;
/* return the result of the evaluation */
return $result;
}
}
$en = new \Psecio\Invoke\Enforcer(__DIR__.'/config/routes.yml');
$allowed = $en->isAuthorized(
new InvokeUser(array('username' => 'ccornutt')),
new \Psecio\Invoke\Resource()
);
if ($allowed === false) {
echo 'ERROR: '.$en->getError();
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.