Laravel 9.32 Released

Published on by

Laravel 9.32 Released image

The Laravel team released 9.32 with dd() file and line output, encrypting and decrypting .env files, a short syntax for blade component attributes, and more:

Add source file to dd output

Nuno Maduro improved dd() and dump() output, adding the source file and line:

This update is beneficial if you have a rogue dd() call within the vendor/ folder or somewhere in code that isn't version controlled. This is a huge quality-of-life improvement for all the dd()'ers out there!

Encrypt and Decrypt .env

Joe Dixon contributed two artisan commands to encrypt and decrypt .env files. According to the the PR description, these commands are inspired by Rails which has similar functionality (since 5.1):

Inspiration for this was taken from Rails, who have had similar functionality since Rails 5.1 released in 2017.

The biggest benefit of this is that the encrypted environment files can be committed to version control which opens up a number of possibilities.

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"

Share WithoutOverlapping key across jobs

Tim MacDonald contributed updates to WithoutOverlapping that apply overlapping logic across jobs instead of only supporting instances of the same class. See Pull Request #44227 for further details.

Short attribute syntax for Blade components

Pascal Baljet contributed the ability to use a shorter syntax for passing attributes to Blade components:

<!-- current syntax -->
<x-profile :user-id="$userId"></x-profile>
 
<!-- short syntax -->
<x-profile :$userId></x-profile>

Get request data as integer and float

Jason McCreary added support for conveniently casting request data to float and integer types:

// Before
intval($request->input('some_int_value'));
floatval($request->input('some_float_value'));
 
// After
$request->integer('some_int_value');
$request->float('some_float_value');

Cast stringables

Jason McCreary contributed methods to "conveniently cast stringables to common data types similar to those found in Laravel's HTTP Request":

// Before
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());
 
 
// After
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 defaults

Florian Stascheck contributed the ability to provide defaults for enum route bindings when defining a route:

Route::get('/categories-default/{category?}', function (CategoryBackedEnum $category = CategoryBackedEnum::Fruits) {
return $category->value;
})->middleware('web');

See Pull Request #44255 for further details on how this works.

Release Notes

You can see the complete list of new features and updates below and the diff between 9.31.0 and 9.32.0 on GitHub. The following release notes are directly from the changelog:

v9.32.0

Added

  • New env:encrypt and env:decrypt commands (#44034)
  • Share WithoutOverlapping key across jobs (#44227)
  • Add missing citext type mapping to Illuminate/Database/Console/DatabaseInspectionCommand::$typeMappings (#44237)
  • Short attribute syntax for Blade Components (#44217)
  • Adds source file to dd function output (#44211)
  • Add methods to get request data as integer or float (#44239)
  • Adds Eloquent User Provider query handler (#44226)
  • Added Illuminate/Support/Testing/Fakes/BusFake::dispatchFakeBatch() (#44176)
  • Added methods to cast Stringables (#44238)
  • Added Illuminate/Routing/UrlGenerator::withKeyResolver() (#44254)
  • Add a hook to the serialisation of collections (#44272)
  • Allow enum route bindings to have default values (#44255)
  • Added benchmark utility class (b4293d7, #44297)
  • Added Illuminate/Console/Scheduling/ManagesFrequencies::everyOddHour() (#44288)

Fixed

  • Fix incrementing string keys (#44247)
  • Fix bug in Fluent Class with named arguments in migrations (#44251)
  • Fix "about" command caching report (#44305)
  • Fixes memory leaks (#44306, #44307)

Changed

  • Patch for timeless timing attack vulnerability in user login (#44069)
  • Refactor: register commands in artisan service (#44257)
  • Allow factories to recycle models with for method (#44265)
  • Use dedicated method for placeholder replacement in validator (#44296)
Paul Redmond photo

Staff writer at Laravel News. Full stack web developer and author.

Cube

Laravel Newsletter

Join 40k+ other developers and never miss out on new tips, tutorials, and more.

Laravel Forge logo

Laravel Forge

Easily create and manage your servers and deploy your Laravel applications in seconds.

Laravel Forge
Tinkerwell logo

Tinkerwell

The must-have code runner for Laravel developers. Tinker with AI, autocompletion and instant feedback on local and production environments.

Tinkerwell
No Compromises logo

No Compromises

Joel and Aaron, the two seasoned devs from the No Compromises podcast, are now available to hire for your Laravel project. ⬧ Flat rate of $7500/mo. ⬧ No lengthy sales process. ⬧ No contracts. ⬧ 100% money back guarantee.

No Compromises
Kirschbaum logo

Kirschbaum

Providing innovation and stability to ensure your web application succeeds.

Kirschbaum
Shift logo

Shift

Running an old Laravel version? Instant, automated Laravel upgrades and code modernization to keep your applications fresh.

Shift
Bacancy logo

Bacancy

Supercharge your project with a seasoned Laravel developer with 4-6 years of experience for just $2500/month. Get 160 hours of dedicated expertise & a risk-free 15-day trial. Schedule a call now!

Bacancy
Lucky Media logo

Lucky Media

Get Lucky Now - the ideal choice for Laravel Development, with over a decade of experience!

Lucky Media
Lunar: Laravel E-Commerce logo

Lunar: Laravel E-Commerce

E-Commerce for Laravel. An open-source package that brings the power of modern headless e-commerce functionality to Laravel.

Lunar: Laravel E-Commerce
LaraJobs logo

LaraJobs

The official Laravel job board

LaraJobs
SaaSykit: Laravel SaaS Starter Kit logo

SaaSykit: Laravel SaaS Starter Kit

SaaSykit is a Multi-tenant Laravel SaaS Starter Kit that comes with all features required to run a modern SaaS. Payments, Beautiful Checkout, Admin Panel, User dashboard, Auth, Ready Components, Stats, Blog, Docs and more.

SaaSykit: Laravel SaaS Starter Kit
Supercharge Your SaaS Development with FilamentFlow: The Ultimate Laravel Filament Boilerplate logo

Supercharge Your SaaS Development with FilamentFlow: The Ultimate Laravel Filament Boilerplate

Build your SaaS application in hours. Out-of-the-box multi-tenancy and seamless Stripe integration. Supports subscriptions and one-time purchases, allowing you to focus on building and creating without repetitive setup tasks.

Supercharge Your SaaS Development with FilamentFlow: The Ultimate Laravel Filament Boilerplate
Rector logo

Rector

Your partner for seamless Laravel upgrades, cutting costs, and accelerating innovation for successful companies

Rector
MongoDB logo

MongoDB

Enhance your PHP applications with the powerful integration of MongoDB and Laravel, empowering developers to build applications with ease and efficiency. Support transactional, search, analytics and mobile use cases while using the familiar Eloquent APIs. Discover how MongoDB's flexible, modern database can transform your Laravel applications.

MongoDB

The latest

View all →
Asymmetric Property Visibility in PHP 8.4 image

Asymmetric Property Visibility in PHP 8.4

Read article
Access Laravel Pulse Data as a JSON API image

Access Laravel Pulse Data as a JSON API

Read article
Laravel Forge adds Statamic Integration image

Laravel Forge adds Statamic Integration

Read article
Transform Data into Type-safe DTOs with this PHP Package image

Transform Data into Type-safe DTOs with this PHP Package

Read article
PHPxWorld - The resurgence of PHP meet-ups with Chris Morrell image

PHPxWorld - The resurgence of PHP meet-ups with Chris Morrell

Read article
Herd Executable Support and Pest 3 Mutation Testing in PhpStorm 2024.3 image

Herd Executable Support and Pest 3 Mutation Testing in PhpStorm 2024.3

Read article