evlz/pest-bundle

Symfony2 Pest Bundle

Installs: 1 072

Dependents: 0

Watchers: 2

Language: PHP

0.3.1 2015-03-09 19:40 UTC

README

Symfony2 Bundle

Service for https://github.com/educoder/pest

Get the bundle

Add to your evlz-pest-bundle to your dependencies:

{

    "require": {
        "evlz/pest-bundle": "~1.0"

    }

}

To install, run php composer[.phar] [update|install].

Add EvlzPestBundle to your application kernel

// app/AppKernel.php

public function registerBundles()

{

    return array(

        // ...

        new Evlz\PestBundle\EvlzPestBundle(),

        // ...

    );

}

You can get the pest service simply by using the container. From your controller you can do:

$baseUrl = 'http://gdata.youtube.com';

// get service

$rest = $this->get('evlz_pest.rest');

// create client. \PestJSON by default

$client = $rest->createClient($baseUrl);

// create \Pest client

$clientType = \Evlz\PestBundle\Entity\Factory::TYPE_MAIN;//
$client = $rest->createClient($baseUrl, $clientType);

// create \Pest client. forced re-creation

$clientType = \Evlz\PestBundle\Entity\Factory::TYPE_JSON;//
$client = $rest->createClient($baseUrl, $clientType, true);

Tests


% phpunit src/Evlz/PestBundle/Tests/Entity/RestTest.php
% phpunit src/Evlz/PestBundle/Tests/Entity/DataConverterTest.php

Please, see https://github.com/educoder/pest for details