nypl / microservice-starter
NYPL Microservice Starter
Installs: 2 227
Dependents: 0
Suggesters: 0
Security: 0
Stars: 7
Watchers: 30
Forks: 5
Open Issues: 6
Requires
- aws/aws-sdk-php: 3.31.4
- danielstjules/stringy: 2.3.2
- guzzlehttp/guzzle: 6.2.3
- monolog/monolog: 1.23.0
- slim/pdo: 1.9.9
- slim/slim: 3.5.0
- vlucas/phpdotenv: 2.4.0
- zircote/swagger-php: 2.0.7
- dev-master
- 1.2.29
- 1.2.28
- 1.2.27
- 1.2.26
- 1.2.25
- 1.2.24
- 1.2.23
- 1.2.22
- 1.2.21
- 1.2.20
- 1.2.19
- 1.2.18
- 1.2.17
- 1.2.16
- 1.2.15
- 1.2.14
- 1.2.13
- 1.2.12
- 1.2.11
- 1.2.10
- 1.2.9
- 1.2.8
- 1.2.7
- 1.2.6
- 1.2.5
- 1.2.4
- 1.2.3
- 1.2.2
- 1.2.1
- 1.2.0
- 1.1.x-dev
- 1.1.43
- 1.1.42
- 1.1.41
- 1.1.40
- 1.1.39
- 1.1.38
- 1.1.37
- 1.1.36
- 1.1.35
- 1.1.34
- 1.1.33
- 1.1.32
- 1.1.31
- 1.1.30
- 1.1.29
- 1.1.28
- 1.1.27
- 1.1.26
- 1.1.25
- 1.1.24
- 1.1.23
- 1.1.22
- 1.1.21
- 1.1.20
- 1.1.19
- 1.1.16
- 1.1.15
- 1.1.14
- 1.1.13
- 1.1.12
- 1.1.11
- 1.1.10
- 1.1.9
- 1.1.8
- 1.1.7
- 1.1.6
- 1.1.5
- 1.1.4
- 1.1.3
- 1.1.2
- 1.1.1
- 1.1.0
- 1.0.49
- 1.0.48
- 1.0.47
- 1.0.46
- 1.0.45
- 1.0.44
- 1.0.43
- 1.0.42
- 1.0.40
- 1.0.39
- 1.0.38
- 1.0.37
- 1.0.36
- 1.0.35
- 1.0.34
- 1.0.33
- 1.0.32
- 1.0.31
- 1.0.30
- 1.0.29
- 1.0.28
- 1.0.27
- 1.0.26
- 1.0.25
- 1.0.24
- 1.0.23
- 1.0.22
- 1.0.21
- 1.0.20
- 1.0.19
- 1.0.18
- 1.0.17
- 1.0.16
- 1.0.15
- 1.0.14
- 1.0.13
- 1.0.12
- 1.0.11
- 1.0.10
- 1.0.9
- 1.0.8
- 1.0.7
- 1.0.6
- 1.0.5
- 1.0.4
- 1.0.3
- 1.0.2
- 1.0.1
- 1.0.0
- 0.1.57
- 0.1.56
- 0.1.55
- 0.1.54
- 0.1.53
- 0.1.52
- 0.1.51
- 0.1.50
- 0.1.49
- 0.1.48
- 0.1.47
- 0.1.46
- 0.1.45
- 0.1.44
- 0.1.43
- 0.1.42
- 0.1.41
- 0.1.40
- 0.1.39
- 0.1.38
- 0.1.37
- 0.1.36
- 0.1.35
- 0.1.34
- 0.1.33
- 0.1.32
- 0.1.31
- 0.1.30
- 0.1.29
- 0.1.28
- 0.1.27
- 0.1.26
- 0.1.25
- 0.1.24
- 0.1.23
- 0.1.22
- 0.1.21
- 0.1.20
- 0.1.19
- 0.1.18
- 0.1.17
- 0.1.16
- 0.1.15
- 0.1.13
- 0.1.12
- 0.1.10
- 0.1.9
- 0.1.8
- 0.1.7
- 0.1.6
- 0.1.5
- 0.1.4
- 0.1.3
- 0.1.2
- 0.1.1
- 0.1.0
- dev-debug-refile
- dev-show-total-count
This package is not auto-updated.
Last update: 2024-04-13 17:57:34 UTC
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).
Installation
Via Composer
"require": {
"nypl/microservice-starter": "~0.1"
}
Requirements
- PHP >=5.5.0
- 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);
});