PHPackages                             olssonm/roaring - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. olssonm/roaring

ActiveLibrary[API Development](/categories/api)

olssonm/roaring
===============

Roaring.io API-wrapper

v2.2(1y ago)014.8k↑200%MITPHPPHP ^8.2

Since Jan 17Pushed 1y ago1 watchersCompare

[ Source](https://github.com/olssonm/roaring)[ Packagist](https://packagist.org/packages/olssonm/roaring)[ Docs](https://github.com/olssonm/roaring)[ GitHub Sponsors](https://github.com/olssonm)[ RSS](/packages/olssonm-roaring/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (5)Dependencies (4)Versions (10)Used By (0)

Roaring.io API-wrapper
======================

[](#roaringio-api-wrapper)

[![Latest Version on Packagist](https://camo.githubusercontent.com/76b92e798686abb50b95d40e7529c629d46625f17c0884a11f027f016d615d57/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6f6c73736f6e6d2f726f6172696e672e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/olssonm/roaring)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Software License](https://camo.githubusercontent.com/2303979fd195afec525441c56762670b656e4d78604ee4cd7227cc80f72d791b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f6f6c73736f6e6d2f726f6172696e672e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/olssonm/roaring)[![Scrutinizer Score](https://camo.githubusercontent.com/828969d9e2b25083593b999aefc8d08e58e49d43ba12546357b52820a527858a/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f6f6c73736f6e6d2f726f6172696e672e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/olssonm/roaring)

This is a (very) simple wrapper for the [roaring.io](https://www.roaring.io/en/) API.

The wrapper is designed to be quick and easy to use – no fuzz. Just create a new object with your API-keys and then call the endpoint you want to call. Though you yourself has to do the data-manipulation to your needs and liking.

The package also includes a service provider for Laravel.

On a sidenote; this package uses the [httpful](https://github.com/nategood/httpful)-library for the HTTP-requests. While [Guzzle](https://github.com/guzzle/guzzle) and the like may generally be recommended, it is easy to introduce conflicts in some frameworks with different versions of those more common libraries.

Requirements
------------

[](#requirements)

PHP ^7.3 / ^8.0

If you want to use the Laravel Service Provider, Laravel 5.5 and above is supported.

Installation
------------

[](#installation)

```
$ composer require olssonm/roaring
```

### Laravel

[](#laravel)

Laravel should auto-discover the service provider. You may also manually add it to your providers-array in `config/app.php`:

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

You may set an alias using the facade in `config/app.php`:

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

For the Roaring object to initialise properly using dependancy injection/the facade, you will need to set your key and secret in `/config/services.php`:

```
'roaring' => [
    'key' => env('ROARING_KEY', 'xxx'),
    'secret' => env('ROARING_SECRET', 'zzz')
]

```

Usage
-----

[](#usage)

Using the wrapper is very simple – just initiate the object and call the endpoint you wish to use.

Used standalone/via main class:

```
use \Olssonm\Roaring\Roaring;

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

Via the Laravel facade/dependancy injection:

```
use Roaring;

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

Roaring.io uses the OAuth-protocol – currently a new OAuth token is created automatically upon initialisation unless an already existing token is passed to the `Roaring`-constructor.

Because the `getResponse()`-method always returns the latest response you can retrieve the token data by just creating a new object and returning the response:

```
$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)
// }
```

You can also use `getToken()` to retrieve it. This gives you the ability to reuse a token (mostly it is quite unnecessary though – just saves you a request if you know your token is still valid) by passing it as the third parameter:

```
use Olssonm\Roaring\Roaring;

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

The returned object is always of the type `stdClass` (internally httpful just unpacks the returned JSON to setup the object).

With `getResponse()` you will recieve the entire response, you may also for example use `getResponse('body')` to only retrieve the `body`, `getResponse('code')` to get the `code`-attribute and so on.

Testing
-------

[](#testing)

First you will need sandbox-keys from roaring.io, once obtained copy `/tests/config.example.json` to `/tests/config.json`, set your keys and then run:

```
$ composer test
```

or

```
$ phpunit
```

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

© 2020 [Marcus Olsson](https://marcusolsson.me).

###  Health Score

41

—

FairBetter than 89% of packages

Maintenance35

Infrequent updates — may be unmaintained

Popularity25

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity79

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~517 days

Total

5

Last Release

608d ago

Major Versions

v1.1 → v2.02020-12-21

PHP version history (5 changes)v1.0PHP &gt;=7.1

v1.1PHP &gt;=7.2

v2.0PHP &gt;=7.3 | ^8.0

v2.1PHP ^7.3 | ^8.0

v2.2PHP ^8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/74a309aadadeae81baef2394d37375673d03f11133b28a831a30825361d1d68c?d=identicon)[olssonm](/maintainers/olssonm)

---

Top Contributors

[![olssonm](https://avatars.githubusercontent.com/u/907114?v=4)](https://github.com/olssonm "olssonm (24 commits)")

---

Tags

apilaravelphproaring

###  Code Quality

TestsPHPUnit

Static AnalysisPsalm

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/olssonm-roaring/health.svg)

```
[![Health](https://phpackages.com/badges/olssonm-roaring/health.svg)](https://phpackages.com/packages/olssonm-roaring)
```

###  Alternatives

[asana/asana

A PHP client for the Asana API

1381.6M4](/packages/asana-asana)[balanced/balanced

Client for Balanced API

72372.9k](/packages/balanced-balanced)[kontent-ai/delivery-sdk-php

Kontent.ai Delivery SDK for PHP

4628.8k](/packages/kontent-ai-delivery-sdk-php)[maksekeskus/maksekeskus-php

Maksekeskus PHP SDK

12179.8k](/packages/maksekeskus-maksekeskus-php)[nlpcloud/nlpcloud-client

NLP Cloud serves high performance pre-trained or custom models for NER, sentiment-analysis, classification, summarization, paraphrasing, grammar and spelling correction, keywords and keyphrases extraction, chatbot, product description and ad generation, intent classification, text generation, image generation, code generation, question answering, automatic speech recognition, machine translation, language detection, semantic search, semantic similarity, tokenization, POS tagging, speech synthesis, embeddings, and dependency parsing. It is ready for production, served through a REST API. This is the PHP client for the API. More details here: https://nlpcloud.com. Documentation: https://docs.nlpcloud.com. Github: https://github.com/nlpcloud/nlpcloud-php

2523.9k](/packages/nlpcloud-nlpcloud-client)[slakbal/gotowebinar

GotoWebinar API wrapper for laravel 5+

1513.1k](/packages/slakbal-gotowebinar)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
