Download the PHP package mortenscheel/laravel-macros without Composer
On this page you can find all versions of the php package mortenscheel/laravel-macros. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download mortenscheel/laravel-macros
More information about mortenscheel/laravel-macros
Files in mortenscheel/laravel-macros
Package laravel-macros
Short Description Useful Laravel macros
License MIT
Homepage https://github.com/mortenscheel/laravel-macros
Informations about the package laravel-macros
Laravel-Macros
A collection of useful macros for Laravel. See details below.
Installation
Via Composer
Macros
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
If the original time is already divisible by $minutes
and the seconds are exactly zero, no rounding will occur.
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::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::plain($body): Response
Convenient macro for returning a plain text response. Simply adds aContent-Type: text/plain;charset=UTF-8
header
Builder
Builder::inlineQuery(): string
Returns the Query SQL with bindings inserted. Useful for debugging queries, but should never be used in production.
Change log
Please see the changelog for more information on what has changed recently.
Testing
Contributing
Please see contributing.md for details and a todolist.
Security
If you discover any security related issues, please email author email instead of using the issue tracker.
Credits
- Morten Scheel
License
MIT license. Please see the license file for more information.