Skip to content

Commit

Permalink
Documentation update for new version
Browse files Browse the repository at this point in the history
  • Loading branch information
Arthur Mogliev committed Oct 4, 2020
1 parent 48a2c94 commit 0d09b83
Show file tree
Hide file tree
Showing 11 changed files with 312 additions and 346 deletions.
16 changes: 7 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
[![Codacy](https://api.codacy.com/project/badge/Grade/02dc4cfb69e34079ab380593fe5f4f70)](https://www.codacy.com/app/articusw/PathHandler?utm_source=github.com&utm_medium=referral&utm_content=Articus/PathHandler&utm_campaign=Badge_Grade)


This library considerably simplifies API development with [Zend Expressive](http://zendframework.github.io/zend-expressive/) by reducing amount of boilerplate code you have to write for each API operation. The idea is to provide a more convenient way to deal with:
This library considerably simplifies API development with [Mezzio](https://docs.mezzio.dev/mezzio/) by reducing amount of boilerplate code you have to write for each API operation. The idea is to provide a more convenient way to deal with:

- routing - routes for all operations are registered automatically
- consuming - each operation may have unique algorithm to parse request body according its content type
Expand All @@ -15,17 +15,15 @@ This library considerably simplifies API development with [Zend Expressive](http

So you can focus on handling your API operations and spend less time on writing auxiliary code for request processing.

## Quick start

Just write [OpenAPI Specification](https://swagger.io/specification/) for your future API and use [OpenAPI Codegen](https://openapi-generator.tech/) to generate `php-ze-ph` server. Check a sample of what you get [here](https://github.com/OpenAPITools/openapi-generator/tree/master/samples/server/openapi3/petstore/php-ze-ph).

## How to install?

Just add `"articus/path-handler": "*"` to your [composer.json](https://getcomposer.org/doc/04-schema.md#require) and check [packages suggested by the library](https://getcomposer.org/doc/04-schema.md#suggest) for extra dependencies of optional components you want to use.
Just add `"articus/path-handler"` to your [composer.json](https://getcomposer.org/doc/04-schema.md#require) and check [packages suggested by the library](https://getcomposer.org/doc/04-schema.md#suggest) for extra dependencies of optional components you want to use.

> *Note* - library has [Laminas Service Manager](https://docs.laminas.dev/laminas-servicemanager/) as direct dependency but only because of [plugin managers](https://docs.laminas.dev/laminas-servicemanager/plugin-managers/). So you can use this library with any PSR-11 container you like.
## How to use?

First of all you need a project with Zend Expressive application. For example you can generate one with [this installer](https://github.com/zendframework/zend-expressive-skeleton).
First of all you need a project with Mezzio application. For example, you can generate one with [this installer](https://github.com/mezzio/mezzio-skeleton).

Next you need to declare **handlers**. Each handler is a set of all **operations** that can be performed when some **path** of your API is accessed with distinct HTTP methods. Any class can be a handler, you just need to decorate it with special annotations:

Expand Down Expand Up @@ -67,12 +65,12 @@ class Handler
}
```

Finally you need to configure special factory for router service (example is in YAML just for readability):
Finally you need to configure special factory for router service. Here is a sample configuration for [Laminas Service Manager](https://docs.laminas.dev/laminas-servicemanager/) (example is in YAML just for readability):

```YAML
dependencies:
factories:
Zend\Expressive\Router\RouterInterface: Articus\PathHandler\RouteInjection\Factory
Mezzio\Router\RouterInterface: Articus\PathHandler\RouteInjection\Factory

Articus\PathHandler\RouteInjection\Factory:
paths:
Expand Down
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"name": "articus/path-handler",
"description": "Library for API development with Zend Expressive that simplifies creating operation middlewares and registering them in router",
"description": "Library for API development with Mezzio that simplifies creating operation middlewares and registering them in router",
"keywords": [
"middleware",
"API",
"zend",
"expressive",
"laminas",
"mezzio",
"routing",
"dispatch"
],
Expand Down Expand Up @@ -33,7 +33,7 @@
"psr/simple-cache": "^1.0",
"laminas/laminas-stdlib": "^3.2",
"nikic/fast-route": "^1.3",
"articus/data-transfer": "dev-migrate-to-laminas",
"articus/data-transfer": "^0.4",
"ext-json": "*",
"ext-uopz": "*",
"phpspec/phpspec": "^5.1|^6.1",
Expand Down

0 comments on commit 0d09b83

Please sign in to comment.