PHPackages                             lrezek/cbor4laravel - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. lrezek/cbor4laravel

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

lrezek/cbor4laravel
===================

CBOR provider for Laravel.

018PHP

Since Jan 9Pushed 11y agoCompare

[ Source](https://github.com/lrezek/Cbor4Laravel)[ Packagist](https://packagist.org/packages/lrezek/cbor4laravel)[ RSS](/packages/lrezek-cbor4laravel/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

\#About Cbor4Laravel adds CBOR functionality to Laravel Requests and Responses. For more information on what CBOR is, please see the [spec](http://cbor.io/).

\#Installation

Add `lrezek/cbor4laravel` as a requirement to `composer.json`:

```
{
    "require": {
       "lrezek/cbor4laravel": "dev-master"
    }
}
```

Depending on your stability settings, you may also need to add a requirement to `"lemonblast/cbor4php": "dev-master"`.

Update your packages with `composer update` or install with `composer install`.

\##Request Because the Request class is made so early in the Laravel lifecycle, you need to override the implementation in `bootstrap/start.php`. Add the following to the start of the file:

```
use Illuminate\Foundation\Application;

Application::requestClass('LRezek\Cbor4Laravel\Http\Request');
```

This enables the following 3 methods:

```
Request::isCbor();    //Returns true if the request is in CBOR format, false otherwise.
Request::wantsCbor(); //Returns true if the accept type of the request is CBOR, false otherwise.
Request::cbor();      //Returns the decoded request content.
```

Please note that all three of these methods are also available in the `Input` Facade, as `Input` and `Request` are the same object in Laravel.

As with `Input::json()`, `Input::cbor()` allows you to get CBOR decoded data in a `ParameterBag`. This means you can specify a key and a default value to get, or get all the input as an array:

```
Input::cbor()->all();         //Get all input as an array.
Input::cbor($key);            //Get value of the specified key in the input.
Input::cbor($key, $default);  //Get value of specified key in the input, or the specified $default if the key isn't found.
```

\##Response To enable CBOR responses, simply replace Laravel's `Response` Facade in the `aliases` array of `app/config/app.php`:

```
  //'Response'      => 'Illuminate\Support\Facades\Response',
    'Response'      => 'LRezek\Cbor4Laravel\Facades\Response',
```

This allows you to use `Response::cbor()` the same way you would use `Response::json()`. For an example of this, please refer to the [Laravel documentation](http://laravel.com/docs/4.2/responses#special-responses).

Additionally, you can make a custom response and format it in CBOR as follows:

```
Response::make($content)->format('cbor'); //Returns a CBOR formatted Response.
```

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/c0f3ca2c31384c90a68edabe69abf18b109b6fd0c255eaf604fca04bb48d5eaf?d=identicon)[lrezek](/maintainers/lrezek)

---

Top Contributors

[![lrezek](https://avatars.githubusercontent.com/u/6645422?v=4)](https://github.com/lrezek "lrezek (36 commits)")

### Embed Badge

![Health badge](/badges/lrezek-cbor4laravel/health.svg)

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

PHPackages © 2026

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