Download the PHP package phapi/middleware-content-negotiation without Composer

On this page you can find all versions of the php package phapi/middleware-content-negotiation. 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 middleware-content-negotiation

Content Negotiation Middleware

Build status Code Climate Test Coverage

The Content Negotiation Middleware contains of one middleware designed to handle format negotiations. It takes the Accept header and parses it, matches it against the list of supported mime types (registered by serializers) and finally sets the proper Content-Type header on the response object.

Installation

This middleware is by default included in the Phapi Framework but if you need to install it it's available to install via Packagist and Composer.

Configuration

The middleware itself does not have any configuration options.

See the configuration documentation for more information about how to configure the integration with the Phapi Framework.

Usage

The format negotiation middleware sets the proper Content-Type header on the response object. The header value can be accessed by using the getHeaderLine() method:

The middleware also sets the mime type and any parameters included in the accept header as attributes on the request object:

Exceptions

The middleware will throw a 406 NotAcceptable if the requested mime type isn't supported. An 500 InternalServerError is thrown if no serializers are found.

If the requested mime type isn't supported the first mime type in the first registered serializers will be used to serialize the error message sent to the client.

Phapi

This middleware is a Phapi package used by the Phapi Framework. The middleware are also PSR-7 compliant and implements the Phapi Middleware Contract.

License

Content Negotiation Middleware is licensed under the MIT License - see the license.md file for details

Contribute

Contribution, bug fixes etc are always welcome.


All versions of middleware-content-negotiation with dependencies

PHP Build Version
Package Version
Requires php Version >=5.6.0
phapi/contract Version 1.*
phapi/exception Version 1.*
psr/http-message Version 1.*
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 phapi/middleware-content-negotiation contains the following files

Loading the files please wait ....