PHP code example of andreyv / yii2-service-events-client

1. Go to this page and download the library: Download andreyv/yii2-service-events-client 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/ */

    

andreyv / yii2-service-events-client example snippets


Yii::$container->setSingleton(
    indigerd\oauth2\authfilter\Module::class,
    indigerd\oauth2\authfilter\Module::class,
    [
        'authFilter',
        null,
        [
            'authServerUrl' => 'https://auth.example.com/api/v1/',
            'clientId' => 'clientId',
            'clientSecret' => 'clientSecret',
            'testMode' => YII_ENV_TEST,
        ]
    ]
);

Yii::$container->set(
    'ServiceEventsHttpClient',
    GuzzleHttp\Client::class,
    [
        ['base_uri' => 'https://events.example.com/api/v1/'],
    ]
);

Yii::$container->set(
    andreyv\events\services\EventsServiceInterface::class,
    andreyv\events\services\EventsService::class,
    [
        Yii::$container->get('ServiceEventsHttpClient'),
    ]
);