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.

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