The Laravel staff launched 9.32 with dd() file and line output, encrypting and decrypting .env recordsdata, a brief syntax for blade part attributes, and extra:
Add supply file to dd output
Nuno Maduro improved dd()
and dump()
output, including the supply file and line:
This replace is useful if in case you have a rogue dd()
name inside the vendor/
folder or someplace in code that is not model managed. This can be a big quality-of-life enchancment for all of the dd()’ers on the market!
Encrypt and Decrypt .env
Joe Dixon contributed two artisan instructions to encrypt and decrypt .env recordsdata. In line with the the PR description, these instructions are impressed by Rails which has comparable performance (since 5.1):
Inspiration for this was taken from Rails, who’ve had comparable performance since Rails 5.1 launched in 2017.
The most important good thing about that is that the encrypted surroundings recordsdata could be dedicated to model management which opens up a lot of prospects.
One profit is you could commit encrypted recordsdata to model management, thus versioning your improvement setup, staging, and many others.:
1# Appears for .env and creates .env.encrypted
2php artisan env:encrypt
3
4# Use a supported cipher
5php artisan env:encrypt --cipher=aes-256-cbc
6
7# Appears for .env.manufacturing and creates .env.manufacturing.encrypted
8php artisan env:encrypt --env=manufacturing
To decrypt an encrypted file, you should utilize the next artisan command:
1# Decrypts .env.encrypted to create a .env file
2php artisan env:decrypt --key=h9kAPUmxdZ8ZbwT3
3
4# Specify choices
5php artisan env:decrypt
6 --key=h9kAPUmxdZ8ZbwT3
7 --env=manufacturing
8 --filename=.env"
Share WithoutOverlapping key throughout jobs
Tim MacDonald contributed updates to WithoutOverlapping
that apply overlapping logic throughout jobs as an alternative of solely supporting situations of the identical class. See Pull Request #44227 for additional particulars.
Quick attribute syntax for Blade elements
Pascal Baljet contributed the flexibility to make use of a shorter syntax for passing attributes to Blade elements:
1<!-- present syntax -->
2<x-profile :user-id="$userId"></x-profile>
3
4<!-- brief syntax -->
5<x-profile :$userId></x-profile>
Get request information as integer and float
Jason McCreary added help for conveniently casting request information to drift and integer sorts:
1// Earlier than
2intval($request->enter('some_int_value'));
3floatval($request->enter('some_float_value'));
4
5// After
6$request->integer('some_int_value');
7$request->float('some_float_value');
Solid stringables
Jason McCreary contributed strategies to “conveniently solid stringables to widespread information sorts just like these present in Laravel’s HTTP Request”:
1// Earlier than
2intval(str('shift-worker-01')->afterLast('-')->toString());
3floatval(str('End result: 1.23')->after(':')->trim()->toString());
4str('YeS')->decrease()->toString() === 'sure';
5Carbon::parse(str('DOB: 12-31-2001')->after(':')->trim()->toString());
6
7
8// After
9str('shift-worker-01')->afterLast('-')->toInteger();
10str('End result: 1.23')->after(':')->trim()->toFloat();
11str('YeS')->decrease()->toBoolean();
12str('DOB: 12-31-2001')->after(':')->trim()->toDate();
Permit enum route bindings to have defaults
Florian Stascheck contributed the flexibility to offer defaults for enum route bindings when defining a route:
1Route::get('/categories-default/{class?}', perform (CategoryBackedEnum $class = CategoryBackedEnum::Fruits) {
2 return $class->worth;
3})->middleware('internet');
See Pull Request #44255 for additional particulars on how this works.
Launch Notes
You possibly can see the whole listing of latest options and updates beneath and the diff between 9.31.0 and 9.32.0 on GitHub. The next launch notes are straight from the changelog:
v9.32.0
Added
- New env:encrypt and env:decrypt instructions (#44034)
- Share WithoutOverlapping key throughout jobs (#44227)
- Add lacking citext sort mapping to
Illuminate/Database/Console/DatabaseInspectionCommand::$typeMappings
(#44237) - Quick attribute syntax for Blade Parts (#44217)
- Provides supply file to dd perform output (#44211)
- Add strategies to get request information as integer or float (#44239)
- Provides Eloquent Person Supplier question handler (#44226)
- Added
Illuminate/Help/Testing/Fakes/BusFake::dispatchFakeBatch()
(#44176) - Added strategies to solid Stringables (#44238)
- Added
Illuminate/Routing/UrlGenerator::withKeyResolver()
(#44254) - Add a hook to the serialisation of collections (#44272)
- Permit enum route bindings to have default values (#44255)
- Added benchmark utility class (b4293d7, #44297)
- Added
Illuminate/Console/Scheduling/ManagesFrequencies::everyOddHour()
(#44288)
Fastened
- Repair incrementing string keys (#44247)
- Repair bug in Fluent Class with named arguments in migrations (#44251)
- Repair “about” command caching report (#44305)
- Fixes reminiscence leaks (#44306, #44307)