PHP code example of itmedia / zippy-bus-bundle

1. Go to this page and download the library: Download itmedia/zippy-bus-bundle library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

itmedia / zippy-bus-bundle example snippets




class AppKernel extends Kernel
{
    public function registerBundles()
    {
        $bundles = [
            // ...
            new Itmedia\ZippyBusBundle\ItmediaZippyBusBundle(),        
        ];
    }
    
    // ...
}

$zippyBusProvider = $container->get('itmedia_zippy_bus.provider');



use \Itmedia\ZippyBusBundle\Client\ZippyBusClient;
use \Itmedia\ZippyBusBundle\ZippyBusProvider;
use \Itmedia\ZippyBusBundle\Factory\ScheduleObjectFromArrayFactory;

// Токен, выданный сервисом
$token = 'my_token';

// Любая библиотека кэширования с поддержкой PSR6 Simple cache, например https://github.com/symfony/cache
$cache = new Cache();

// Время жизни кэша (секунд). По умолчанию 3600 (1 час)
$cacheTtl = 3600; 

$apiClient = new ZippyBusClient($token, $cache, $cacheTtl);
$zippyBusProvider = new ZippyBusProvider($apiClient, new ScheduleObjectFromArrayFactory());