2017 © Pedro Peláez
 

library negotiators

A package to do content and language negotiation.

image

tdt/negotiators

A package to do content and language negotiation.

  • Wednesday, February 20, 2013
  • by coreation
  • Repository
  • 5 Watchers
  • 0 Stars
  • 854 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 0 % Grown

The README.md

tdt/negotiators

Build Status, (*1)

Content and language negotiation written in PHP: GET parameters will overwrite accept header. Support for logging (monolog)., (*2)

Installation

Install as a requirement using composer:, (*3)

  1. Add a composer.json in your root, (*4)

  2. Add a requirement:, (*5)

{ 
  "require" : { 
     "tdt/negotiators" : "1.0.*" 
  }
}
  1. Install composer: http://getcomposer.com, (*6)

  2. run "composer install", (*7)

  3. include vendor/autoload.php, (*8)

Usage

$cn = new \tdt\negotiators\ContentNegotiator();
$format = $cn->pop();
$default_format = "json";

// $this->formatAllowed is a function you have to define yourself
while (!$this->formatAllowed($format) && $cn->hasNext()) {
    $format = $cn->pop();
}

if(! $this->formatAllowed($format)){
     throw new Exception("Could not find an appropriate formatter.");
}

// use $format further on

Testing

Using phpunit:, (*9)

$ phpunit tests

The Versions

20/02 2013

dev-master

9999999-dev http://thedatatank.com

A package to do content and language negotiation.

  Sources   Download

AGPLv3

The Requires

 

content negotiation language negotiation

20/02 2013

v1.0.2

1.0.2.0 http://thedatatank.com

A package to do content and language negotiation.

  Sources   Download

AGPLv3

The Requires

 

content negotiation language negotiation

23/01 2013

v1.0.1

1.0.1.0 http://thedatatank.com

A package to do content and language negotiation.

  Sources   Download

AGPLv3

The Requires

 

content negotiation language negotiation

20/01 2013

v1.0.0

1.0.0.0 http://thedatatank.com

A package to do content and language negotiation.

  Sources   Download

AGPLv3

The Requires

 

content negotiation language negotiation