Download the PHP package woohoolabs/yin-middleware without Composer

On this page you can find all versions of the php package woohoolabs/yin-middleware. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package yin-middleware

Woohoo Labs. Yin Middleware

Latest Version on Packagist Build Status Coverage Status Quality Score Total Downloads Gitter

Woohoo Labs. Yin Middleware is a collection of middleware which helps you to integrate Woohoo Labs. Yin into your PHP applications.

Table of Contents

Introduction

Features

Install

The only thing you need before getting started is Composer.

Install a PSR-7 implementation:

Because Yin Middleware requires a PSR-7 implementation (a package which provides the psr/http-message-implementation virtual package), you must install one first. You may use Zend Diactoros or any other library of your preference:

Install Yin Middleware:

To install the latest version of this library, run the command below:

Note: The tests and examples won't be downloaded by default. You have to use composer require woohoolabs/yin-middleware --prefer-source or clone the repository if you need them.

Yin Middleware 4.1 requires PHP 7.4 at least, but you may use Yin Middleware 4.0.0 for PHP 7.1.

Install the optional dependencies:

If you want to use JsonApiRequestValidatorMiddleware and JsonApiResponseValidatorMiddleware from the default middleware stack then you have to require the following dependencies too:

Basic Usage

Supported middleware interface design

The interface design of Yin-Middleware is based on the PSR-15 de-facto standard. That's why it is compatible with Woohoo Labs. Harmony, Zend-Stratigility, Zend-Expressive and many other frameworks.

The following sections will guide you through how to use and configure the provided middleware.

Note: When passing a ServerRequestInterface instance to your middleware dispatcher, a WoohooLabs\Yin\JsonApi\Request\JsonApiRequestInterface instance must be used in fact (the WoohooLabs\Yin\JsonApi\Request\JsonApiRequest class possibly), otherwise the JsonApiDispatcherMiddleware and the JsonApiExceptionHandlerMiddleware will throw an exception.

YinCompatibilityMiddleware

This middleware facilitates the usage of Yin and Yin-Middleware in other frameworks. It does so by upgrading a basic PSR-7 request object to JsonApiRequest, which is suitable for working with Yin. Please keep in mind, that this middleware should precede any other middleware that uses JsonApiRequest as $request parameter.

Available configuration options for the middleware (they can be passed to the constructor):

JsonApiRequestValidatorMiddleware

The middleware is mainly useful in a development environment, and it is able to validate a PSR-7 request against the JSON and the JSON:API schema. Just add it to your application (the example is for Woohoo Labs. Harmony):

If validation fails, an exception containing the appropriate JSON:API errors will be thrown. If you want to customize the error messages or the response, provide an Exception Factory of your own. For other customizations, feel free to extend the class.

Available configuration options for the middleware (they can be passed to the constructor):

JsonApiResponseValidatorMiddleware

The middleware is mainly useful in a development environment, and it is able to validate a PSR-7 response against the JSON and the JSON:API schema. Just add it to your application (the example is for Woohoo Labs. Harmony):

If validation fails, an exception containing the appropriate JSON:API errors will be thrown. If you want to customize the error messages or the response, provide an Exception Factory of your own. For other customizations, feel free to extend the class.

Available configuration options for the middleware (they can be passed to the constructor):

JsonApiDispatcherMiddleware

This middleware is able to dispatch JSON:API-aware controllers. Just add it to your application (the example is for Woohoo Labs. Harmony):

This middleware works exactly as the one in Woohoo Labs. Harmony, the only difference is that it dispatches controller actions with the following signature:

instead of:

The difference is subtle, as the $jsonApi object contains a PSR-7 compatible request, and PSR-7 responses can also be created with it. Learn more from the documentation of Woohoo Labs. Yin.

Available configuration options for the middleware (they can be passed to the constructor):

JsonApiExceptionHandlerMiddleware

It catches exceptions and responds with an appropriate JSON:API error response.

Available configuration options for the middleware (they can be passed to the constructor):

Versioning

This library follows SemVer v2.0.0.

Change Log

Please see CHANGELOG for more information what has changed recently.

Testing

Woohoo Labs. Yin Middleware has a PHPUnit test suite. To run the tests, run the following command from the project folder after you have copied phpunit.xml.dist to phpunit.xml:

Additionally, you may run docker-compose up or make test in order to execute the tests.

Contributing

Please see CONTRIBUTING for details.

Support

Please see SUPPORT for details.

Credits

License

The MIT License (MIT). Please see the License File for more information.


All versions of yin-middleware with dependencies

PHP Build Version
Package Version
Requires php Version ^7.4.0||^8.0.0
psr/container Version ^1.0.0
psr/http-message-implementation Version ^1.0.0
psr/http-server-middleware Version ^1.0.0
woohoolabs/yin Version ^4.0.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package woohoolabs/yin-middleware contains the following files

Loading the files please wait ....