reliv/pipe-rat

Create REST APIs with just a few lines of config. This PSR7 compliant PHP library uses Zend\Stragility Middleware at its core.

Maintainers

👁 reliv

Package info

github.com/reliv/pipe-rat

pkg:composer/reliv/pipe-rat

Statistics

Installs: 1 966

Dependents: 4

Suggesters: 0

Stars: 3

Open Issues: 0

0.6.0 2019-12-05 16:02 UTC

Requires (Dev)

Suggests

Provides

None

Conflicts

None

Replaces

None

BSD-3-Clause f76a5b10194a18701fed7d2397ecffd9cdcc32cc

restapimodulemiddlewarereliv


README

Create REST APIs with just a few lines of config. This PSR7 compliant PHP library that uses Zend\Stragility Middleware at its core.

@todo Docs

  • There is a name collision happening when pre and|or post service options have the same name I.E.: responseHeaders in this example, looses the postServiceOptions values in the 'findById'

    'xxx' => [
     'controllerServiceName' => 'Reliv\PipeRat\Middleware\ResourceController\DoctrineResourceController',
     'controllerServiceOptions' => [
     'entity' => null,
     ],
     'methods' => [
     'findById' => [
     'postServiceNames' => [
     'extractor' => 'Reliv\PipeRat\Middleware\Extractor\PropertyGetterExtractor',
     'responseHeaders' => 'Reliv\PipeRat\Middleware\Header\AddResponseHeaders',
     ],
     'postServiceOptions' => [
     'responseHeaders' => [
     'headers' => [
     'My' => 'header'
     ]
     ]
     ],
     ],
     ],
     'preServiceOptions' => [
     ],
     'preServicePriority' => [
     // 'JsonRequestFormat' => 1000,
     ],
     'postServiceNames' => [
     'responseHeaders' => 'Reliv\PipeRat\Middleware\Header\AddResponseHeaders',
     'JsonResponseFormat' => 'Reliv\PipeRat\Middleware\ResponseFormat\JsonResponseFormat',
     'XmlResponseFormat' => 'Reliv\PipeRat\Middleware\ResponseFormat\XmlResponseFormat',
     'DefaultResponseFormat' => 'Reliv\PipeRat\Middleware\ResponseFormat\JsonResponseFormat',
     ],
     'postServiceOptions' => [
     'DefaultResponseFormat' => [
     'accepts' => [
     '*/*'
     ],
     ],
     ],
    ]