aaieduhr/aosi-module-rest-server
Composer 安装命令:
composer require aaieduhr/aosi-module-rest-server
包简介
AOSI REST Server Module
README 文档
README
Provides pluggable JSON endpoints for AOSI modules.
Installation
composer require aaieduhr/aosi-module-rest-server
Enable aaieduhr/aosi-module-rest-server in the AOSI modules.enabled
configuration. AOSI core registers methods returned by each enabled module's
getRestServerMethods() manifest method.
Calling a method
Every method is exposed through POST /AOSI.rest/{method} and requires an
application/json object body:
POST /AOSI.rest/anonSearch
Content-Type: application/json
{
"base": "dc=example,dc=org",
"filter": "(uid=test)",
"attributes": ["uid", "cn"]
}
Success:
{"data":{"uid=test,dc=example,dc=org":{"uid":["test"]}}}
Errors use RFC 9457-style application/problem+json responses and meaningful
HTTP status codes.
Providing methods
Return AaiEduHr\Aosi\RestServer\MethodDescriptor instances from an AOSI
module manifest's getRestServerMethods() method. Handlers may be container
services such as [ExampleHandler::class, 'example']; request parameters are
validated from their SchemaDescriptor definitions before invocation.
For small modules, returning descriptors directly from the manifest or a required config file is usually enough. For larger method sets, prefer an autoloaded provider class and keep the config file as a thin delegation, for example:
use Vendor\ExampleModule\Config\ExampleRestMethods;
return ExampleRestMethods::all();
This module's config/rest_methods.php follows that pattern. Avoid defining
shared closures inside config files as the reference style. Generic descriptor
helpers are available through AaiEduHr\Aosi\RestServer\DescriptorFactory;
module-specific helpers, such as default handler mapping or common parameter
groups, should remain in the module provider class.
The generated API descriptions are available at:
/rest-server-documentation/rest-server-openapi.json
Licence
This work is published under the European Union Public License v1.2.
统计信息
- 总下载量: 1
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 2
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: EUPL-1.2
- 更新时间: 2026-07-03