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

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.

image
Tinkerwell

Version 4 of Tinkerwell is available now. Get the most popular PHP scratchpad with all its new features and simplify your development workflow today.

Visit Tinkerwell
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

Bespoke software solutions built for your business. We ♥ Laravel

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
Larafast: Laravel SaaS Starter Kit logo

Larafast: Laravel SaaS Starter Kit

Larafast is a Laravel SaaS Starter Kit with ready-to-go features for Payments, Auth, Admin, Blog, SEO, and beautiful themes. Available with VILT and TALL stacks.

Larafast: Laravel SaaS Starter Kit
SaaSykit: Laravel SaaS Starter Kit logo

SaaSykit: Laravel SaaS Starter Kit

SaaSykit is a 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
Rector logo

Rector

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

Rector

The latest

View all →
Anonymous Event Broadcasting in Laravel 11.5 image

Anonymous Event Broadcasting in Laravel 11.5

Read article
Microsoft Clarity Integration for Laravel image

Microsoft Clarity Integration for Laravel

Read article
Apply Dynamic Filters to Eloquent Models with the Filterable Package image

Apply Dynamic Filters to Eloquent Models with the Filterable Package

Read article
Property Hooks Get Closer to Becoming a Reality in PHP 8.4 image

Property Hooks Get Closer to Becoming a Reality in PHP 8.4

Read article
Asserting Exceptions in Laravel Tests image

Asserting Exceptions in Laravel Tests

Read article
Reversible Form Prompts and a New Exceptions Facade in Laravel 11.4 image

Reversible Form Prompts and a New Exceptions Facade in Laravel 11.4

Read article