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

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

mortenscheel/laravel-macros
===========================

Useful Laravel macros

v1.3.1(3y ago)1268MITPHPCI failing

Since Sep 17Pushed 2y ago1 watchersCompare

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

READMEChangelog (2)Dependencies (5)Versions (8)Used By (0)

Laravel-Macros
==============

[](#laravel-macros)

[![Latest Version on Packagist](https://camo.githubusercontent.com/2e6ceb170ec2058111a0652fbcfa7f6e2ce0bce2d2482ca4f7d55d994d3c745b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d6f7274656e73636865656c2f6c61726176656c2d6d6163726f732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/mortenscheel/laravel-macros)[![Total Downloads](https://camo.githubusercontent.com/df22d36a35e029144d4284974959046ebaf130006c6440fc9f7c9a5e7dd52cf8/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6d6f7274656e73636865656c2f6c61726176656c2d6d6163726f732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/mortenscheel/laravel-macros)

A collection of useful macros for Laravel. See details below.

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

[](#installation)

Via Composer

```
$ composer require mortenscheel/laravel-macros
```

Macros
------

[](#macros)

### Carbon

[](#carbon)

`Carbon::upToNearest(int $minutes): Carbon`

Rounds up to the nearest minute divisible by `$minutes`

`Carbon::downToNearest(int $minutes): Carbon`

Rounds down to the nearest minute divisible by `$minutes`

### Note

[](#note)

If the original time is already divisible by `$minutes` and the seconds are exactly zero, no rounding will occur.

### Filesystem

[](#filesystem)

`File::modify(string $path, \Closure $callback)`

The `$callback` will receive the current content of the file, and the return value will be stored back to the same `$path`

### Collection

[](#collection)

`Collection::sortKeysRecursively(bool $descending = false): Collection`

Sorts the Collection by keys, recursively.

Useful for comparing nested associative arrays where the contents may be sorted differently.

### Response

[](#response)

`Response::plain($body): Response`

Convenient macro for returning a plain text response. Simply adds a`Content-Type: text/plain;charset=UTF-8` header

### Builder

[](#builder)

`Builder::inlineQuery(): string`

Returns the Query SQL with bindings inserted. Useful for debugging queries, but should never be used in production.

Change log
----------

[](#change-log)

Please see the [changelog](changelog.md) for more information on what has changed recently.

Testing
-------

[](#testing)

```
$ ./vendor/bin/phpunit
```

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

[](#contributing)

Please see [contributing.md](contributing.md) for details and a todolist.

Security
--------

[](#security)

If you discover any security related issues, please email author email instead of using the issue tracker.

Credits
-------

[](#credits)

- [Morten Scheel](%5Blink-author%5D)

License
-------

[](#license)

MIT license. Please see the [license file](license.md) for more information.

###  Health Score

29

—

LowBetter than 57% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity63

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

Total

5

Last Release

1399d ago

Major Versions

v0.1 → 1.02020-06-21

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/6514342?v=4)[Morten Scheel](/maintainers/mortenscheel)[@mortenscheel](https://github.com/mortenscheel)

---

Top Contributors

[![mortenscheel](https://avatars.githubusercontent.com/u/6514342?v=4)](https://github.com/mortenscheel "mortenscheel (9 commits)")

---

Tags

laravelmacrosLaravelMacros

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3355.3M337](/packages/psalm-plugin-laravel)[renatomarinho/laravel-page-speed

Laravel Page Speed

2.5k1.7M11](/packages/renatomarinho-laravel-page-speed)[vinkius-labs/laravel-page-speed

Laravel Page Speed

2.5k9.6k1](/packages/vinkius-labs-laravel-page-speed)[webwizo/laravel-shortcodes

Wordpress like shortcodes for Laravel 11, 12 and 13

217700.9k8](/packages/webwizo-laravel-shortcodes)[emargareten/inertia-modal

Inertia Modal is a Laravel package that lets you implement backend-driven modal dialogs for Inertia apps.

90142.9k](/packages/emargareten-inertia-modal)[erag/laravel-pwa

A simple and easy-to-use PWA (Progressive Web App) package for Laravel applications.

180124.1k](/packages/erag-laravel-pwa)

PHPackages © 2026

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