In the new version 9.32 we have Some of the new features.
- Short attribute syntax for Blade Components https://github.com/laravel/framework/pull/44217
<!-- current syntax --> <x-profile :user-id="$userId"></x-profile> <!-- short syntax --> <x-profile :$userId></x-profile>
- Adds source file to dd function output https://github.com/laravel/framework/pull/44211 https://www.youtube.com/watch?v=9vfrRAv63ZY
dd() and dump() output, adding the source file and line
- Add methods to get request data as integer or float https://github.com/laravel/framework/pull/44239
This adds methods to conveniently retrieve and cast request data as an int and float. A bool cast already existed. So why not have other common scalar types.
intval($request->input('some_int_value')); floatval($request->input('some_float_value')); // Now $request->integer('some_int_value'); $request->float('some_float_value');
- Add methods to cast Stringables https://github.com/laravel/framework/pull/44238
intval(str('shift-worker-01')->afterLast('-')->toString()); floatval(str('Result: 1.23')->after(':')->trim()->toString()); str('YeS')->lower()->toString() === 'yes'; Carbon::parse(str('DOB: 12-31-2001')->after(':')->trim()->toString()); // Now str('shift-worker-01')->afterLast('-')->toInteger(); str('Result: 1.23')->after(':')->trim()->toFloat(); str('YeS')->lower()->toBoolean(); str('DOB: 12-31-2001')->after(':')->trim()->toDate();
- Allow enum route bindings to have default values https://github.com/laravel/framework/pull/44255
enum Status: string { case Published = 'published'; case Draft = 'draft'; } Route::get('/posts/{status}', function(Status $status) {}); Route::get('/posts/{status?}', function(Status $status = Status::Published) {});
- Encrypt and Decrypt .env https://github.com/laravel/framework/pull/44034#issue-1364610312
One benefit is that you can commit encrypted files to version control, thus versioning your development setup, staging, etc.
# Looks for .env and creates .env.encrypted php artisan env:encrypt # Use a supported cipher php artisan env:encrypt --cipher=aes-256-cbc # Looks for .env.production and creates .env.production.encrypted php artisan env:encrypt --env=production
To decrypt an encrypted file, you can use the following artisan command
# Decrypts .env.encrypted to create a .env file php artisan env:decrypt --key=h9kAPUmxdZ8ZbwT3 # Specify options php artisan env:decrypt \ --key=h9kAPUmxdZ8ZbwT3 \ --env=production \ --filename=.env"
- test the performance with the Benchmarking helper
https://laravel-news.com/laravel-benchmark
https://github.com/laravel/framework/pull/44297
https://www.youtube.com/watch?v=a4cLlxQjMTk
https://www.youtube.com/watch?v=ubYl20CG_MM
https://laravel.com/docs/9.x/helpers#benchmarking
// Before... Benchmark::dd(fn () => sleep(1)); // 1002.61591713213123 // After... Benchmark::dd(fn () => sleep(1)); // "1,002.615ms"
More about Benchmark :-
https://www.youtube.com/watch?v=I0ZngrKbemI
https://github.com/laravel/framework/commit/b4293d7c18b08b363ac0af64ec04fb1d559b4698
- Ignore case in Stringable contains() and containsAll() https://github.com/laravel/framework/pull/44369
case-insensitive support to Stringable contains() and containsAll() methods
// returns true $this->stringable('taylor') ->contains(['LOR'], true); // returns true $this->stringable('taylor otwell') ->containsAll(['TAYLOR', 'OTWELL'], true);
- Adds support for PHP's BackedEnum to be "rendered" on views https://github.com/laravel/framework/pull/44445
enum UserRoles: string { case ADMIN = 'Admin'; } // routes/web.php Route::get('/', function () { return view('dashboard', ['role' => UserRoles:: ADMIN]); }); // dashboard.blade.php Hello, {{ $role }}. // ❌ Before: TypeError: htmlspecialchars(): Argument #1 ($string) must be of type string // ✅ After: Hello, Admin.
- Short attribute syntax for Self Closing Blade Components https://github.com/laravel/framework/pull/44413
<!-- current short syntax --> <x-profile :$userId></x-profile> <!-- short syntax for self-closing component --> <x-profile :$userId/>
I hope you enjoyed with me and to learn more about this release visit the sources and search more. I adore you who search for everything new.
Source :- https://www.youtube.com/watch?v=0yc9mY_MPxI
Source :- https://laravel-news.com/laravel-9-32-0
Source :- https://laravel-news.com/laravel-9-34-0
Source :- https://www.youtube.com/watch?v=AjOnRIj3-UQ
Top comments (0)