PHPackages                             kodeops/rro - 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. kodeops/rro

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

kodeops/rro
===========

Rich response object plugin.

1.4.4(11mo ago)113.7k↓44.6%1MITPHPPHP ^7|^8CI failing

Since Jul 2Pushed 11mo ago1 watchersCompare

[ Source](https://github.com/kodeops/rro)[ Packagist](https://packagist.org/packages/kodeops/rro)[ Docs](https://github.com/kodeops/rro)[ RSS](/packages/kodeops-rro/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependencies (2)Versions (30)Used By (1)

```
 _     _  _____  ______  _______  _____   _____  _______
 |____/  |     | |     \ |______ |     | |_____] |______
 |    \_ |_____| |_____/ |______ |_____| |       ______|

```

rro | rich response object
==========================

[](#rro--rich-response-object)

Setup
-----

[](#setup)

Add composer package:

`$ composer require kodeops/rro:dev-master`

Copy function helpers to your project within your namespace (recommended, not mandatory):

Add `rro-helpers.php` to `composer.json` autoload section:

```
"autoload": {
    ...

   "files": [
       "vendor/kodeops/rro/src/helpers.php"
   ]
}

```

Usage
-----

[](#usage)

Assuming helper functions are loaded in `composer.json`:

```
$rro = error()
  ->type('error_type')
  ->message('This is a sample rich response object.')
  ->code(404)
  ->data(['foo' => 'bar']);

```

Checking status:

```
if ($rro->isError()) {
  // Response contains an error payload
}

if ($rro->isSuccess()) {
  // Response contains a success payload
}

```

Additionaly, `isError` and `isSuccess` accepts two parameters for checking `type` or `message` content:

```
if ($rro->isError('type', 'error_type')) {
  // Response contains an error type equals to "error_type"
}

if ($rro->isError('message', 'Error message')) {
  // Response contains an error message equals to "error_type"
}

if ($rro->isSuccess('type', 'success_type')) {
  // Response contains a success type equals to "success_type"
}

if ($rro-> isSuccess('message', 'Success message')) {
  // Response contains a message equals to "Success message"
}

```

Or you can access independent whether it's an `error` or `response`:

```
if ($rro->response('is_type', 'error_type')) {
  // returns true if given type matches response type
}

if ($rro->response('is_message', 'Descriptive error message')) {
  // returns true if given message matches response message
}

```

Accessing response:

```
$type = $rro->response('type');
$message = $rro->response('message');
$foo = $rro->response('data', 'foo');
$code = $rro->response('code');
$add = $rro->response('add', ['bar' => 'foo']);

```

Methods
-------

[](#methods)

### Building response

[](#building-response)

---

### `type(string $string)`

[](#typestring-string)

Set the type for the response.

### `message(string $string)`

[](#messagestring-string)

Set the message for the response.

### `data(array $data)`

[](#dataarray-data)

Set the data for the response.

### `code(int $code)`

[](#codeint-code)

Set the status code for the response.

### `trans(string $translation)`

[](#transstring-translation)

Uses the translation to set the `type` and the translation itself is placed in the `message`.

A valid translation path must be entered, if not it will throw an `rroException`.

### Check response status

[](#check-response-status)

---

### `isError()`

[](#iserror)

Wether the response is an error.

### `isSuccess()`

[](#issuccess)

Wether the response is a success.

### Accessing response details

[](#accessing-response-details)

---

### `response('type')`

[](#responsetype)

Get the response type.

### `response('message')`

[](#responsemessage)

Get the response message.

### `response('data', $dot)`

[](#responsedata-dot)

Get the response data array (uses dot syntax to retrieve specific key).

Example: `response('data', 'user.id')`

### `response('code')`

[](#responsecode)

Get the response code.

### `response('add', array $data)`

[](#responseadd-array-data)

Add more items to the data array (will be automatically merged to existing data).

### `response('is_type', $type)`

[](#responseis_type-type)

Wether the response type equals to the parameter sent.

### `response('is_message', $message)`

[](#responseis_message-message)

Wether the response message equals to the parameter sent.

### Render response

[](#render-response)

---

### HTML raw code `toHtml()`

[](#html-raw-code-tohtml)

Will output the message and type in HTML as follows:

```
{{ $message }}
{{ $type }}

```

So this snippet:

```
return success()
	->type('item_updated')
	->message('Item successfully updated!')
	->toHtml();

```

will produce:

```
Item successfully updated!
item_update

```

If `type` is not set, `h3` tag will not be rendered.

### Render to array `toArray()`

[](#render-to-array-toarray)

Render response to a simple array (otherwise responds with an instance of rro class).

So this snippet:

```
return success()
  ->type('item_updated')
  ->message('Item successfully updated!')
  ->toArray();

```

will produce:

```
[
  "response" => [
    "type" => "item_updated",
    "message" => "Item successfully updated!",
  ]
];

```

### For Laravel response `toResponse()`

[](#for-laravel-response-toresponse)

Render response in Laravel way.

###  Health Score

44

—

FairBetter than 90% of packages

Maintenance52

Moderate activity, may be stable

Popularity25

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity74

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 ~92 days

Recently: every ~350 days

Total

29

Last Release

339d ago

PHP version history (4 changes)1.0PHP &gt;=5.5

1.2.1PHP ^7.1.3

1.4.1PHP ^7.1.3|^8.0

1.4.3PHP ^7|^8

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/40502810?v=4)[kodeops](/maintainers/kodeops)[@kodeops](https://github.com/kodeops)

---

Top Contributors

[![xavierhb](https://avatars.githubusercontent.com/u/2368418?v=4)](https://github.com/xavierhb "xavierhb (46 commits)")

---

Tags

pluginlaravelutilskodeops

### Embed Badge

![Health badge](/badges/kodeops-rro/health.svg)

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

###  Alternatives

[firefly-iii/data-importer

Firefly III Data Import Tool.

8035.8k](/packages/firefly-iii-data-importer)[markwalet/nova-modal-response

A Laravel Nova asset for Modal responses on an action.

17878.9k](/packages/markwalet-nova-modal-response)[ronasit/laravel-helpers

Provided helpers function and some helper class.

2085.6k30](/packages/ronasit-laravel-helpers)[team-nifty-gmbh/tall-datatables

Server-side rendered datatables for Laravel and Livewire

1320.9k4](/packages/team-nifty-gmbh-tall-datatables)[tomshaw/electricgrid

A feature-rich Livewire package designed for projects that require dynamic, interactive data tables.

119.4k](/packages/tomshaw-electricgrid)

PHPackages © 2026

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