PHPackages                             efureev/response-actions - 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. [HTTP &amp; Networking](/categories/http)
4. /
5. efureev/response-actions

ActiveLibrary[HTTP &amp; Networking](/categories/http)

efureev/response-actions
========================

Single Action structure for HTTP-Response

v2.1.2(7mo ago)17.9kMITPHPPHP ^8.4CI passing

Since Apr 21Pushed 7mo ago1 watchersCompare

[ Source](https://github.com/efureev/response-actions)[ Packagist](https://packagist.org/packages/efureev/response-actions)[ RSS](/packages/efureev-response-actions/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (2)Dependencies (4)Versions (18)Used By (0)

Response Action
===============

[](#response-action)

[![](https://camo.githubusercontent.com/baf0a85636a322ff99514b39a158b0de14708c8758b3427397df0a09897c82f8/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d382e342d626c75652e737667)](https://camo.githubusercontent.com/baf0a85636a322ff99514b39a158b0de14708c8758b3427397df0a09897c82f8/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d382e342d626c75652e737667)[![PHP Package](https://github.com/efureev/response-actions/actions/workflows/php.yml/badge.svg)](https://github.com/efureev/response-actions/actions/workflows/php.yml)[![Build Status](https://camo.githubusercontent.com/98331e971a6986b0ef01d2d0c2b925deb5cbf520fc705c708d4c53910660f71b/68747470733a2f2f7472617669732d63692e6f72672f656675726565762f726573706f6e73652d616374696f6e732e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/efureev/response-actions)[![Latest Stable Version](https://camo.githubusercontent.com/72e0f81ee310b75388dd6372d88331baf4b949cdc261bb9c586b81244b7719c6/68747470733a2f2f706f7365722e707567782e6f72672f656675726565762f726573706f6e73652d616374696f6e732f762f737461626c653f666f726d61743d666c6174)](https://packagist.org/packages/efureev/response-actions)[![Maintainability](https://camo.githubusercontent.com/d53bf2573399867b07f09be96628b963e6e60be13699c50f37168e5701643aa2/68747470733a2f2f716c74792e73682f67682f656675726565762f70726f6a656374732f726573706f6e73652d616374696f6e732f6d61696e7461696e6162696c6974792e737667)](https://qlty.sh/gh/efureev/projects/response-actions)[![Code Coverage](https://camo.githubusercontent.com/241079a3acbfac79686a8a9d8447fc005e8058c0583430d1acd0d49993e47857/68747470733a2f2f716c74792e73682f67682f656675726565762f70726f6a656374732f726573706f6e73652d616374696f6e732f636f7665726167652e737667)](https://qlty.sh/gh/efureev/projects/response-actions)[![codecov](https://camo.githubusercontent.com/c33cf5c2e8b43bcb11eedbf8cf51450206f9a10af34af846a46801b1d230a217/68747470733a2f2f636f6465636f762e696f2f6769746875622f656675726565762f726573706f6e73652d616374696f6e732f67726170682f62616467652e7376673f746f6b656e3d6674674e58684a55786b)](https://codecov.io/github/efureev/response-actions)

Install
-------

[](#install)

For php &gt;= 8.4

```
composer require efureev/response-actions "^2.0"
```

Action Message Response Structure
---------------------------------

[](#action-message-response-structure)

```
{
  // Action Message block (can be overwritten with a custom key)
  "_responseAction": {
    // Request Execution Status. See: ResponseActions\\StatusEnum
    "status": "success",
    // list of actions: array of ResponseActions\\Actions\\Action
    "actions": [
      {
        // ... some action's body
      }
    ],
    // optional extra payload attached to the response action
    "extra": { }
  }
}
```

### Actions

[](#actions)

- Message
- Command
- Download
- Event
- Redirect

#### Common Action's Props

[](#common-actions-props)

```
{
  // Action's Name
  "name": "message",
  // Action order to perform. Default = 0
  "order": 1,
  // Private action. boolean true or string channel name
  "private": true
}
```

#### Action Message

[](#action-message)

```
{
  // message to show to user
  "message": "It's done!",
  // Type of the message (optional when type is empty)
  "type": "info"
}
```

```
use ResponseActions\ResponseAction;
use ResponseActions\Actions\Message;

ResponseAction::successMessage('Operation has success!');

// Multi-message with different types
ResponseAction::errorMessage('Operation has failed!')
    ->addAction(Message::info('Try to restart page'));
```

#### Action Command

[](#action-command)

```
{
  // pending | done | failed
  "status": "failed",
  // optional description
  "description": "Reason..."
}
```

Helpers:

- ResponseAction::cmd() // pending
- ResponseAction::cmdDone() // done
- ResponseAction::cmdFailed() // failed

#### Action Download

[](#action-download)

```
{
  "url": "https://example.com/file.pdf",
  "file": "Readme.pdf",
  // optional params passed to the client handler
  "params": {}
}
```

#### Action Event

[](#action-event)

```
{
  "event": "uploadData",
  "params": {}
}
```

#### Action Redirect

[](#action-redirect)

```
{
  "url": "https://example.com",
  "target": "_blank",
  // native | router
  "type": "native",
  // HTTP code (when applicable)
  "code": 302
}
```

You can also use helpers:

- ResponseAction::redirect('')
- ResponseActions\\Actions\\Redirect::router('/route')
- ResponseActions\\Actions\\Redirect::native('')

### Private

[](#private)

You can use private props and order:

```
use ResponseActions\ResponseAction;
use ResponseActions\Actions\{Event, Redirect, Download};

$responseAction = ResponseAction::successMessage('Operation has done!')
    ->addAction(
        new Event('log', ['saved!', 'continue watching...']),
        (new Event('uploadModuleData'))->private(),
        (new Event('uploadData'))->private('menu'),
        (new Event('refreshUser'))->private('authUser')->withOrder(1),
        (new Redirect('https://example.com'))->withOrder(5),
        (new Download('https://example.com/file.pdf', 'Readme.pdf'))->withOrder(2),
    );
```

### ExtraData

[](#extradata)

You can attach extra data to the whole ResponseAction or to Message actions:

```
use ResponseActions\ResponseAction;

$responseAction = ResponseAction::cmdDone()
    ->withExtra(['any' => 'thing']);
```

###  Health Score

44

—

FairBetter than 92% of packages

Maintenance62

Regular maintenance activity

Popularity20

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity70

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

Recently: every ~0 days

Total

17

Last Release

234d ago

Major Versions

v1.5.1 → v2.x-dev2025-09-26

PHP version history (2 changes)v1.0.0PHP ^8.1|^8.2

v2.x-devPHP ^8.4

### Community

Maintainers

![](https://www.gravatar.com/avatar/62a6e061d1ccab4d5de8dcba717b7634f91e4842b32ca26420b8261c66104bf7?d=identicon)[efureev](/maintainers/efureev)

---

Top Contributors

[![efureev](https://avatars.githubusercontent.com/u/5524684?v=4)](https://github.com/efureev "efureev (2 commits)")

---

Tags

responsephpactions

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/efureev-response-actions/health.svg)

```
[![Health](https://phpackages.com/badges/efureev-response-actions/health.svg)](https://phpackages.com/packages/efureev-response-actions)
```

PHPackages © 2026

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