PHP code example of yilu-tech / permission
1. Go to this page and download the library: Download yilu-tech/permission 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/ */
yilu-tech / permission example snippets
/**
* member-service
* config/permission.php
*/
return [
'server' => 'member'
'endpoints' => [
'staff' => [
'url' => 'http://api.test.com/staff',
'scopes' => 'admin',
]
];
];
// 以上配置亦可简写成如下形式
return [
'server' => 'member'
'endpoints' => 'http://api.test.com/staff',
];
/**
* staff-service
* config/permission.php
*/
return [
'server' => 'staff'
'local' => [
'name' => 'admin', 'scopes' => 'admin'
],
];
/**
* member-service
* config/permission.php
*/
return [
'server' => 'member'
'endpoints' => [
'staff' => [
'url' => 'http://api.test.com/staff',
'scopes' => 'admin',
],
'management' => [
'url' => 'http://api.test.com/management',
'scopes' => 'management',
],
];
];
/**
* staff-service
* config/permission.php
*/
return [
'server' => 'staff'
'local' => [
'name' => 'admin', 'scopes' => 'admin'
],
'endpoints' => [
'management' => [
'url' => 'http://api.test.com/management',
'scopes' => 'management',
],
]
];