PHP code example of olssonm / roaring

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

    

olssonm / roaring example snippets


$ composer 

'providers' => [
    Olssonm\Roaring\Laravel\ServiceProvider::class
]

'aliases' => [
    'Roaring' => Olssonm\Roaring\Laravel\Facades\Roaring::class
]

use \Olssonm\Roaring\Roaring;

$response = (new Roaring('key', 'secret'))
    ->get('/se/company/overview/1.1/5567164818')
    ->getResponse();

use Roaring;

$response = Roaring::get('/se/company/overview/1.1/5567164818')
    ->getResponse();

$token = (new Roaring('key', 'secret'))->getResponse('body');

var_dump($token);

// object(stdClass)#26 (4) {
//   ["access_token"]=>
//   string(36) "xxxx-xxxx-xxxx-xxxx-xxxx"
//   ["scope"]=>
//   string(28) "am_application_scope default"
//   ["token_type"]=>
//   string(6) "Bearer"
//   ["expires_in"]=>
//   int(2184)
// }


use Olssonm\Roaring\Roaring;

$response = (new Roaring('key', 'secret', $token))
    ->get('/se/company/overview/1.1/5567164818')
    ->getResponse();