stacey/patricia-client-package

此包可简化在patricia上设置客户端结构的操作

v1.0.0 2021-01-21 01:37 UTC

README

PHP库,用于Patricia Technologies的客户端和客户端密钥管理

安装

composer require stacey/patricia-client-package
require_once 'vendor/autoload.php';
use PatriciaClient\Patricia;
$patricia = new Patricia();
Run Patricia::migrate();
to migrate your tables and default seeders

运行迁移

Run migration
Patricia::migrate();
or
$patricia->migrate();

删除表

Patricia::rollbackMigrate();
 or
$patricia->rollbackMigrate();

回滚 Seeder

Patricia::rollbackSeeders();
 or
$patricia->rollbackSeeders();

创建客户端

  Patricia::createClient(string $clientName, string $clientRole) 
  or
  $patricia->createClient(string $clientName, string $clientRole)

  clientRole is either `admin` or `user`

创建客户端密钥

Patricia::createClientKey(int $clientId, string $clientKeyName);
$patricia->createClientKey(int $clientId, string $clientKeyName);

更新客户端

Patricia::updateClient(string $ClientUuid, array $array);
$patricia->updateClient(string $ClientUuid, array $array);

$array should contain the columns and respective values;
example $array = [
    'name' => 'Patricia King',
    'is_blocked' => 1
];

更新客户端密钥

Patricia::updateClientKeys(int $clientKeyId, array $array);
$patricia->updateClientKeys(int $clientKeyId, array $array);

$array should contain the columns and respective values;
example $array = [
    'name' => 'Patricia King Key',
    'is_blocked' => 1
];

获取客户端详细信息

get a client details based on column attribute

Patricia::getClient(string $columnName, string $columnValue);
$patricia->getClient(string $columnName, string $columnValue);

$array should contain the columns and respective values;
example $array = [
    'name' => 'Patricia King Key',
    'is_blocked' => 1
];

获取客户端密钥详细信息

returns all instances of a client key

Patricia::getClientKeys(int $clientKeyId);
$patricia->getClientKeys(int $clientKeyId);

获取客户端密钥详细信息

returns the first instance of a client key

Patricia::getClientKey(int $clientKeyId);
$patricia->getClientKey(int $clientKeyId);

删除客户端

Patricia::deleteClient(string $clientUuid);
$patricia->deleteClient(string $clientUuid);

删除客户端密钥

Patricia::deleteClientKey(int $clientKeyId);
$patricia->deleteClientKey(int $clientKeyId);

辅助函数

检查用户是否为管理员

isAdmin(string $apiKey)

检查用户是否已认证

isAuthenticated(string $apiKey)

获取客户端详细信息

getClient(string $prop, string $value)
`prop represents a column`
`value represents the value for query`

许可证

Released under the MIT License. See the bundled LICENSE file for details.

贡献

欢迎任何人的贡献,可以提交PR,将会被接受。谢谢并祝好运