PHPackages                             sergiosgc/negotiated-output - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. sergiosgc/negotiated-output

ActiveLibrary[API Development](/categories/api)

sergiosgc/negotiated-output
===========================

A template router based on content negotiation

11PHP

Since Apr 11Pushed 3y ago2 watchersCompare

[ Source](https://github.com/sergiosgc/negotiated-output)[ Packagist](https://packagist.org/packages/sergiosgc/negotiated-output)[ RSS](/packages/sergiosgc-negotiated-output/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

composer-negotiated-output
==========================

[](#composer-negotiated-output)

A content negotiation based template router

Objective
---------

[](#objective)

A typical PHP application processes requests in two phases:

1. Execute the requested operation
2. Produce the output

On RESTful applications, the output is dependent on who is on the other side. If it is a human, then the output is HTML, if not, it's some programatically consumable data format (usually JSON or XML).

This package uses the Accepts HTTP header to decide the output type, and calls the templating script required for the correct output type. It is agnostic to template engine solutions. It just routes the output logic to the appropriate script in the filesystem.

Usage scenario
--------------

[](#usage-scenario)

```
