protonlabs/scim-schema
最新稳定版本:v0.2.1
Composer 安装命令:
composer require protonlabs/scim-schema
包简介
SCIM schema library
关键字:
README 文档
README
SCIM schema PHP library with support for both v1 and v2.
This library is a fork of https://github.com/tmilos/scim-s to make it compatible with modern PHP
Note: This library is still work in progress, and you are welcome to help and contribute
It was made by the specs from SimpleCloud and by the example documents generated by PowerDMS/Owin.Scim
Do not miss SCIM Filter Parser !
Install
Install Scim Schema using composer:
composer require protonlabs/scim-schema
Usage
Schema
Build default schema:
$schemaBuilder = new SchemaBuilderV2(); // or SchemaBuilderV1 $groupSchema = $schemaBuilder->getGroup(); $userSchema = $schemaBuilder->getUser(); $enterpriseUserSchema = $schemaBuilder->getEnterpriseUser(); $schemaSchema = $schemaBuilder->getSchema(); $serviceProviderConfigSchema = $schemaBuilder->getServiceProviderConfig(); $resourceTypeSchema = $schemaBuilder->getResourceType();
Or build your own custom schema:
$schema = new Schema(); $schema->setName('CustomSchema'); $schema->addAttribute( AttributeBuilder::create('name', ScimConstants::ATTRIBUTE_TYPE_STRING, 'Name of the object') ->setMutability(false) ->getAttribute() );
And serialize the scim schema object
$schema = (new SchemaBuilderV2())->getUser(); $schema->serializeObject();
Schema validation
An object can be validated against a schema:
/** @var array $object */ $object = getTheObjectAsArray(); $validator = new SchemaValidator(); $objectSchema = getTheSchema(); $schemaExtensions = getSchemaExtensions(); $validationResult = $validator->validate( $object, $objectSchema, $schemaExtensions ); if (!$validationResult->getErrors()) { // cool! } else { print implode("\n", $validationResult->getErrorsAsStrings()); }
统计信息
- 总下载量: 20.79k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-10-27