nedwave/syndicateplusclient-bundle

A Symfony2 bundle for working with the SyndicatePlusClient

0.2 2013-10-19 14:26 UTC

README

A Symfony2 bundle for working with the SyndicatePlusClient

This bundle uses SyndicatePlusClient.

Installation

Step1: Require the package with Composer

composer require nedwave/syndicateplusclient-bundle

Step2: Enable the bundle

Enable the bundle in the kernel:

<?php
// app/AppKernel.php

public function registerBundles()
{
    $bundles = array(
        // ...

        new Nedwave\SyndicatePlusClientBundle\NedwaveSyndicatePlusClientBundle(),
    );
}

Step3: Configure

Finally, add the following to your parameters.yml

# app/config/parameters.yml

nedwave_syndicate_plus_client.api_key:  # Your API key
nedwave_syndicate_plus_client.api_secret:  # Your API secret

and parameters.yml.dist

# app/config/parameters.yml.dist

nedwave_syndicate_plus_client.api_key: ~
nedwave_syndicate_plus_client.api_secret: ~

Congratulations! You're ready.

Use the API

public function getProductsAction(Request $request)
{
    $client = $this->get('nedwave_syndicate_plus_client.client');
    $params = $request->query->all();

    return new Response(
        $client->getProducts($params)
    );
}

public function getProductByIdAction($id)
{
    $client = $this->get('nedwave_syndicate_plus_client.client');

    return new Response(
        $client->getProductById($id)
    );
}

public function getProductByEanAction($ean)
{
    $client = $this->get('nedwave_syndicate_plus_client.client');

    return new Response(
        $client->getProductByEan($ean)
    );
}

public function getManufacturers(Request $request)
{
    $client = $this->get('nedwave_syndicate_plus_client.client');
    $params = $request->query->all();

    return new Response(
        $client->getManufacturers($params)
    );
}

public function getBrands(Request $request)
{
    $client = $this->get('nedwave_syndicate_plus_client.client');
    $params = $request->query->all();

    return new Response(
        $client->getBrands($params)
    );
}

public function getRetailers(Request $request)
{
    $client = $this->get('nedwave_syndicate_plus_client.client');
    $params = $request->query->all();

    return new Response(
        $client->getRetailers($params)
    );
}

For full usage of the SyndicatePlusClient client see the SyndicatePlusClient repository.