PHP code example of roskovynskyi / ubki

1. Go to this page and download the library: Download roskovynskyi/ubki 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/ */

    

roskovynskyi / ubki example snippets




use Wearesho\Bobra\Ubki;

$config = new Ubki\Push\Config(
    'username',
    'password',
    $mode = Ubki\Authorization\ConfigInterface::MODE_TEST // или MODE_PRODUCTION
);



use Wearesho\Bobra\Ubki;

$config = new Ubki\Pull\Config(
    'username',
    'password',
    $mode = Ubki\Authorization\ConfigInterface::MODE_TEST // или MODE_PRODUCTION
);



use Wearesho\Bobra\Ubki;

$authProvider = new Ubki\Authorization\Provider(
    new \GuzzleHttp\Client(), // любой клиент, имплементирующий \GuzzleHttp\ClientInterface
    new Psr\Log\NullLogger() // любой логгер, имплементирующий \Psr\Log\LoggerInterface
);

$service = new Ubki\Push\Registry\Service(
    new Ubki\Push\EnvironmentConfig("UBKI_"),
    $authProvider,
    new \GuzzleHttp\Client(), // любой клиент, имплементирующий \GuzzleHttp\ClientInterface
    new Psr\Log\NullLogger() // любой логгер, имплементирующий \Psr\Log\LoggerInterface
);

$request = new Ubki\Push\Registry\Rep\Request(...);
$response = $service->send($request);