PHP code example of mibo / px
1. Go to this page and download the library: Download mibo/px 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/ */
mibo / px example snippets
// Load the user that has permissions.
/** @var \MiBo\PX\Contracts\HasPermissionsInterface $user */
$user;
if ($user->hasPermission("my.own.permission")) {
// Do some action
} else {
// You may log that the user is missing
class MyUser implements \MiBo\PX\Contracts\HasPermissionsInterface
{
use \MiBo\PX\Contracts\HasPermissionsTrait;
public function __construct()
{
$this->registerPermissions(
[
"my.own.permission",
"my.another.permission"
]
);
}
}