nypl/microservice-starter
Composer 安装命令:
composer require nypl/microservice-starter
包简介
NYPL Microservice Starter
README 文档
README
This package is intended to be used as the starter package for PHP-based NYPL Microservices.
This package adheres to PSR-1, PSR-2, and PSR-4 (using the Composer autoloader).
Deployment
This library is intended to be used as a Composer dependency hosted on Packagist. To deploy a new version, create a numeric tag, like "2.0.0" and push it up to Github. Then, log into Packagist and hit the update button to pull in the new tag. This will make your new tag available as a Composer dependency version that your apps can access.
Installation
Via Composer
"require": {
"nypl/microservice-starter": "^2.0.3"
}
Requirements
- PHP >= 8.3
- PHP Extensions
Features
- RESTful HTTP framework (Slim)
- Database PDO library (Slim-PDO)
- Kafka message publishing (Rdkafka)
- Avro serializer (Avro)
- Swagger documentation generator (swagger-php)
- Error logging (Monolog)
- Identity/JWT authentication via NYPL API Gateway (
X-NYPL-Identity)
Usage
HTTP/API Server
See the samples/service directory to learn how to create an example service.
Basic Example
Create an index.php with a Service object and your Slim routes:
$service = new NYPL\Starter\Service();
$service->get("/v0.1/bibs", function (Request $request, Response $response) {
$controller = new Controller\BibController($request, $response);
return $controller->getBibs();
});
Configure your web server to load index.php on all requests.
See the samples/service-config directory for sample configuration files for an Apache .htaccess or Nginx nginx.conf installation.
Swagger Documentation Generator
Create a Swagger route to generate Swagger specification documentation:
$service->get("/swagger", function (Request $request, Response $response) {
return SwaggerGenerator::generate(__DIR__ . "/src", $response);
});
Forked Avro library
A fork of the Avro PHP library is included in this repo. See the Avro README for details.
nypl/microservice-starter 适用场景与选型建议
nypl/microservice-starter 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 3.02k 次下载、GitHub Stars 达 7, 最近一次更新时间为 2016 年 10 月 18 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 nypl/microservice-starter 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 nypl/microservice-starter 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 3.02k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 7
- 点击次数: 12
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Unknown
- 更新时间: 2016-10-18