budgetdumpster/slim-content-negotiation

Content Negotiation Middleware for Slim 3.0

1.0.0 2017-12-13 17:39 UTC

This package is not auto-updated.

Last update: 2024-04-22 05:37:23 UTC


README

Installation

composer require budgetdumpster/slim-content-negotiation:1.0.0

Usage

The Content Negotiation Middleware can be easily attached to a slim route like so:

<?php

use BudgetDumpster\Middleware\ContentNegotiation;

$app->get('/', function($request, $response, $args) {
    echo 'hello world';
})->add(new ContentNegotiationHalJson);

This will reject any requests that don't have content-types that match the provided content types.