Skip to content

this bundle provides easy integration of the Cyclocity OpenData Rest API provided by JCDecaux

Notifications You must be signed in to change notification settings

killerwolf/JCDecauxCyclocityBundle

Repository files navigation

JCDecauxCyclocityBundle

Scrutinizer Code Quality SensioLabsInsight Dependency Status

This is a simple bundle to use the JCDecaux Cyclocity OpenData Rest API in a Symfony2 project

Install

Install with composer and enable the bundle in the kernel.

Usage

First, Add your API KEY (from jcdecaux developers portal) in app/conf/config.yml

killerwolf_jc_decaux_cyclocity:
    api_key: "YOU_API_KEY"

Finaly use the service into your controller,

<?php

namespace Killerwolf\JCDecauxCyclocityBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;

class DefaultController extends Controller
{
    public function indexAction(Request $request)
    {
    	$api = $this->get('cyclocity.data');

        return $this->render(
            'KillerwolfJCDecauxCyclocityBundle:Default:index.html.twig', 
            [
                'stations' => $api->getStationsByContract( 'Paris' )
            ]
        );
    }
}

About

this bundle provides easy integration of the Cyclocity OpenData Rest API provided by JCDecaux

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages