Laravel 9.30 Released

Published on by

Laravel 9.30 Released image

The Laravel team released 9.29 and 9.30 with a read-only filesystem option, a scoped filesystem driver, the ability to discard model changes, and more.

Note: we last covered Laravel 9.28.0, so this release post covers both 9.29 and 9.30.

Read-only filesystem config option

Frank de Jonge contributed to configuring a filesystem disk to operate in read-only mode. This ensures no write operations are possible on the disk, which is useful when accessing storage you want to ensure doesn't manipulate any files.

Here's a config example from the pull request for this feature:

$disk = $filesystem->build([
'driver' => 'local',
'read-only' => true,
'root' => 'my-custom-path',
'url' => 'my-custom-url',
'visibility' => 'public',
]);

Scoped filesystem driver

Frank de Jonge contributed scoped filesystem drivers, which enables a way to reuse disk configurations. Here's an example from the pull request description:

[
's3' => [
'driver' => 's3',
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'region' => env('AWS_DEFAULT_REGION'),
'bucket' => env('AWS_BUCKET'),
'url' => env('AWS_URL'),
'endpoint' => env('AWS_ENDPOINT'),
'use_path_style_endpoint' => env('AWS_USE_PATH_STYLE_ENDPOINT', false),
'throw' => false,
],
's3_videos' => [
'driver' => 'scoped',
'prefix' => 'path/for/videos',
'disk' => 's3',
],
]

Add force option to all "make" commands

James Brooks contributed a --force flag to all make:* commands, which is helpful when you need to recreate a file.

"Required if accepted" validation rule

Pascal Baljet contributed a required_if_accepted validation rule which ensures the field under validation is required if another field is accepted (a value of yes, on, 1, or true):

Validator::make([
'is_company' => 'on',
'company_name' => 'Apple',
], [
'is_company' => 'required|boolean',
'company_name' => 'required_if_accepted:is_company',
]);

Ability to discard Eloquent model changes

Mior Muhammad Zaki contributed a discardChanges() method to discard attribute changes and reset attributes to their original state:

$user = new EloquentModelStub([
'name' => 'Taylor Otwell',
]);
 
$user->getOriginal('name'); // null
 
$user->getAttribute('name'); // Taylor Otwell
$user->discardChanges();
$user->getAttribute('name'); // null

Determine if attachments exist

Andrew Minion contributed to determining if the given attachments are included in a mailable. Three methods were added that can help assert attachments in tests:

$mailable = new InvoicePaid($user);
 
// Test normal attachment.
$this->assertTrue(
$mailable->hasAttachment('Receipt.pdf')
);
 
// Test attachment from storage disk.
$this->assertTrue(
$mailable->hasAttachmentFromStorageDisk('s3', 'invoices', $user->latest_invoice->name)
);
 
// Test raw attachment.
$this->assertTrue(
$mailable->hasAttachedData('12345', 'confirmation.txt')
);

Release Notes

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

v9.30.0

Added

  • Added stop_buffering config option to logger (#44071)
  • Added read-only filesystem adapter decoration as a config option (#44079)
  • Added scoped filesystem driver (#44105)
  • Add force option to all make commands (#44100)

Fixed

  • Fixed QueryBuilder whereNot with array conditions (#44083)

Changed

  • Passing event into viaQueue and viaConnection of Queued Listener (#44080)
  • Improve testability of batched jobs (#44075)
  • Allow any kind of whitespace in cron expression (#44110)

v9.29.0

Added

  • Added RequiredIfAccepted validation rule (#44035)
  • Added Illuminate/Foundation/Vite::assetPath() (#44037)
  • Added ability to discard Eloquent Model changes (#43772)
  • Added ability to determine if attachments exist to Illuminate/Mail/Mailable (#43967)
  • Added Illuminate/Support/Testing/Fakes/BusFake::assertNothingBatched() (#44056)

Reverted

Fixed

  • Avoid Passing null to parameter exception on PHP 8.1 (#43951)
  • Align Remember Me Cookie Duration with CookieJar expiration (#44026)
  • Fix Stringable typehints with Enumerable (#44030)
  • Fixed middleware "SetCacheHeaders" with file responses (#44063)

Changed

  • Don't use locks for queue job popping for PlanetScale's MySQL-compatible Vitess engine (#44027)
  • Avoid matching 'use' in custom Stub templates in Illuminate/Console/GeneratorCommand.php (#44049)
Paul Redmond photo

Full stack web developer. Author of Lumen Programming Guide and Docker for PHP Developers.

Cube

Laravel Newsletter

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

image
Honeybadger

Fix Laravel errors in record time. Fill in the gaps with uptime, cron, and heartbeat monitoring. Build trust with status pages and incident management—all in one simple platform.

Visit Honeybadger

The latest

View all →
Use Ollama LLM Models Locally with Laravel image

Use Ollama LLM Models Locally with Laravel

Read article
TallStackUI - a new component library for TALL Stack apps image

TallStackUI - a new component library for TALL Stack apps

Read article
Laravel 10.34 Released image

Laravel 10.34 Released

Read article
Laravel Tailwind Merge image

Laravel Tailwind Merge

Read article
Generate Validation Rules from a Database Schema in Laravel image

Generate Validation Rules from a Database Schema in Laravel

Read article
A Feature Flags Implementation for Filament image

A Feature Flags Implementation for Filament

Read article
Honeybadger logo

Honeybadger

Zero-instrumentation, 360 degree coverage of errors, outages and service degradation.

Honeybadger
Laravel Forge logo

Laravel Forge

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

Laravel Forge
Oh Dear logo

Oh Dear

Oh Dear is the best all-in-one monitoring tool for all your Laravel apps.

Oh Dear
Tinkerwell logo

Tinkerwell

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

Tinkerwell
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
LoadForge logo

LoadForge

Easy, affordable load testing and stress tests for websites, APIs and databases.

LoadForge
Paragraph logo

Paragraph

Manage your Laravel app as if it was a CMS – edit any text on any page or in any email without touching Blade or language files.

Paragraph
Lucky Media logo

Lucky Media

Bespoke software solutions built for your business. Partner with Lucky Media, your favorite Laravel Development Agency!

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