PHPackages                             appstract/laravel-response-macros - 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. appstract/laravel-response-macros

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

appstract/laravel-response-macros
=================================

Extra Response Macro's for Laravel

1.0.0(8y ago)321.5k4MITPHPPHP &gt;=5.6

Since Jul 6Pushed 8y ago4 watchersCompare

[ Source](https://github.com/appstract/laravel-response-macros)[ Packagist](https://packagist.org/packages/appstract/laravel-response-macros)[ RSS](/packages/appstract-laravel-response-macros/feed)WikiDiscussions master Synced 2w ago

READMEChangelog (1)Dependencies (2)Versions (7)Used By (0)

Laravel Response Macros
=======================

[](#laravel-response-macros)

[![Latest Version on Packagist](https://camo.githubusercontent.com/2fec08cab1aa6348f9b7719a38f2c4bfa80c98316d143ff2ff2ceb3cc8497557/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6170707374726163742f6c61726176656c2d726573706f6e73652d6d6163726f732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/appstract/laravel-response-macros)[![Total Downloads](https://camo.githubusercontent.com/736a43fed32004ddf4e9d57387f63c94ba20e7f1663aa699614c9f73f3780178/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6170707374726163742f6c61726176656c2d726573706f6e73652d6d6163726f732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/appstract/laravel-response-macros)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Build Status](https://camo.githubusercontent.com/b5f98478c5d157a1f92c600b99cc63c666b19246984d1ebcfe4fe578f2ae0b1e/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f6170707374726163742f6c61726176656c2d726573706f6e73652d6d6163726f732f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/appstract/laravel-response-macros)

This package is a collection of custom response macros that you can re-use in a variety of your routes and controllers.

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

[](#installation)

You can install the package via composer:

```
composer require appstract/laravel-response-macros
```

Usage
-----

[](#usage)

### Message

[](#message)

```
return response()->message('hello world!', 200);
```

Result

```
{
    "message": "hello world!"
}
```

With the Http `Status Code: 200`

### Error

[](#error)

```
return response()->error('Something went wrong', $statuscode = 400);
```

Result

```
{
    "message": "Something went wrong"
}
```

With the Http `Status Code: 400`

### Success

[](#success)

```
return response()->success(['some' => 'data'], $statuscode = 200);
```

Result

```
{
    "data": {"some": "data"}
}
```

With the Http `Status Code: 200`

### PDF

[](#pdf)

Creates a (downloadable) PDF response from PDF contents.

```
return response()->pdf($pdfData, 'filename.pdf', $download = false);
```

Testing
-------

[](#testing)

```
$ composer test
```

Contributing
------------

[](#contributing)

Contributions are welcome, [thanks to y'all](https://github.com/appstract/laravel-blade-directives/graphs/contributors) :)

About Appstract
---------------

[](#about-appstract)

Appstract is a small team from The Netherlands. We create (open source) tools for webdevelopment and write about related subjects on [Medium](https://medium.com/appstract). You can [follow us on Twitter](https://twitter.com/teamappstract), [buy us a beer](https://www.paypal.me/teamappstract/10) or [support us on Patreon](https://www.patreon.com/appstract).

License
-------

[](#license)

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

###  Health Score

34

—

LowBetter than 75% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity28

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 91.9% 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 ~40 days

Recently: every ~50 days

Total

6

Last Release

3081d ago

Major Versions

0.2.2 → 1.0.02018-01-22

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/377001?v=4)[Ronald Krentz](/maintainers/Rokr)[@rokr](https://github.com/rokr)

---

Top Contributors

[![303K](https://avatars.githubusercontent.com/u/3934941?v=4)](https://github.com/303K "303K (34 commits)")[![gizburdt](https://avatars.githubusercontent.com/u/1470623?v=4)](https://github.com/gizburdt "gizburdt (2 commits)")[![ovanschie](https://avatars.githubusercontent.com/u/3015449?v=4)](https://github.com/ovanschie "ovanschie (1 commits)")

---

Tags

laravelmacrosphpresponseresponsephplaravelappstractmacros

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/appstract-laravel-response-macros/health.svg)

```
[![Health](https://phpackages.com/badges/appstract-laravel-response-macros/health.svg)](https://phpackages.com/packages/appstract-laravel-response-macros)
```

###  Alternatives

[appstract/laravel-opcache

PHP OPcache Artisan commands for Laravel.

1.4k5.1M7](/packages/appstract-laravel-opcache)[gehrisandro/tailwind-merge-laravel

TailwindMerge for Laravel merges multiple Tailwind CSS classes by automatically resolving conflicts between them

341790.3k28](/packages/gehrisandro-tailwind-merge-laravel)[markwalet/nova-modal-response

A Laravel Nova asset for Modal responses on an action.

17818.7k](/packages/markwalet-nova-modal-response)[werxe/laravel-collection-macros

Custom Laravel Collection macros.

2626.6k](/packages/werxe-laravel-collection-macros)[iteks/laravel-enum

A comprehensive Laravel package providing enhanced enum functionalities, including attribute handling, select array conversions, and fluent facade interactions for robust enum management in Laravel applications.

2518.6k](/packages/iteks-laravel-enum)[tomshaw/electricgrid

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

119.2k](/packages/tomshaw-electricgrid)

PHPackages © 2026

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