nypl/microservice-starter 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

nypl/microservice-starter

最新稳定版本:2.0.3

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.

统计信息

  • 总下载量: 3k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 7
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 7
  • Watchers: 27
  • Forks: 5
  • 开发语言: PHP

其他信息

  • 授权协议: Unknown
  • 更新时间: 2016-10-18

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固