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

ActiveLibrary

janchris80/laravel-macros
=========================

Reusable laravel macros.

010PHP

Since May 16Pushed 1y agoCompare

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

READMEChangelogDependenciesVersions (1)Used By (0)

Laravel Macros
==============

[](#laravel-macros)

Reusable laravel macros.

Test Response Macros
====================

[](#test-response-macros)

### dd

[](#dd)

Helpful for inspecting the response and output of your controllers during phpunit testing.

```
$response = $this->post(...);

$response
    ->dd() // prints the json response or the error response if any.
    ->assertOk()
    ->assertJson(...);
```

### ddO

[](#ddo)

Similar to `$response->dd()` but it dump the original content instead.

```
$response = $this->post(...);

$response
    ->ddO() // prints the original content of the response.
    ->assertOk()
    ->assertJson(...);
```

Query Builder Macros
====================

[](#query-builder-macros)

### toRawSql

[](#torawsql)

Return the mysql raw query. Include the parsed sql bindings. Also available to eloquent model.

```
DB::table('users')->whereRaw('active = ?', [1])->toRawSql(); // select * from users where active = 1
User::whereRaw('active = ?', [1])->toRawSql(); // select * from users where active = 1
```

### dd

[](#dd-1)

Dd the raw sql. Helpful for debugging in between query method calls. Enabled in `local` and `testing` environments only because you don't want to `dd` your queries and let other people see it.

```
User::where('active', 1)
    ->dd() // dd here will print "select * from users where active = 1"
    ->whereNotNull('email')
    ->dd() // dd here will print "select * from users where active = 1 and email is not null"
    ->get();

```

### log

[](#log)

For logging mysql queries.

```
User::where('active', 1)
    ->whereNotNull('email')
    ->log() // will log "select * from users where active = 1 and email is not null"
    ->get();

```

Request Macros
==============

[](#request-macros)

### bool

[](#bool)

Cast input to boolean.

```
$request->input('keep_me_logged_in'); // "false"
$request->bool('keep_me_logged_in'); // false
```

### int

[](#int)

Cast input to integer.

```
$request->input('quantity'); // "1,000"
$request->int('quantity'); // 1000
```

### float

[](#float)

Cast input to float.

```
$request->input('price'); // "1,000.50"
$request->float('price'); // 1000.50
```

### Merging the casted input into the request permanently.

[](#merging-the-casted-input-into-the-request-permanently)

```
$request->merge($request->float(['price', 'cost', 'vat', 'discount']));
```

###  Health Score

15

—

LowBetter than 3% of packages

Maintenance26

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity18

Early-stage or recently created project

 Bus Factor1

Top contributor holds 83.3% 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/c61396f20bfc54eb388e7d746bcd1c01f1112df166fac0c9d8ebd9c549df0a97?d=identicon)[janchris80](/maintainers/janchris80)

---

Top Contributors

[![ajcastro](https://avatars.githubusercontent.com/u/4918318?v=4)](https://github.com/ajcastro "ajcastro (5 commits)")[![janchris80](https://avatars.githubusercontent.com/u/34290503?v=4)](https://github.com/janchris80 "janchris80 (1 commits)")

### Embed Badge

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

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

PHPackages © 2026

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