Laravel 9.30 released with stop_buffering config option for logging, filesystem read-only mode disk operation ability, scoped filesystem driver to create a version of the existing storage driver, force options for artisan make commands, and more including the fixes. Let’s check these updates in detail here:
1. Logging stop_buffering
config option:
Wim Ulkeman contributed by adding the stop_buffering config option for the Log Handler configuration to resume the buffering after a flush occurs for debug records to support the large and heavy applications with their debug log records when the error logging passed. Previously, the Log handler stop buffering log records after its first flush (due to the $stopBuffering property).
'stderr' => [ 'driver' => 'monolog', 'handler' => StreamHandler::class, 'level' => 'debug', 'action_level' => 'critical', 'stop_buffering' => false, 'with' => [ 'stream' => 'php://stderr', 'bubble' => false, ], ],
2. Filesystem read-only
mode disk operation ability:
Frank de Jonge contributed by adding filesystem read-only mode disk operation ability. It ensures there no write operation is possible on the disk if the option is set to true for the adapter with files while receiving from shared storage.
use Illuminate\Support\Facades\Storage; $disk = Storage::build([ 'driver' => 'local', 'read-only' => true, 'root' => 'my-custom-path', 'url' => 'my-custom-url', 'visibility' => 'public', ]);
Source File Edits: src/Illuminate/Filesystem/FilesystemManager.php
/** * Create a Flysystem instance with the given adapter. * * @param \League\Flysystem\FilesystemAdapter $adapter * @param array $config * @return \League\Flysystem\FilesystemOperator */ protected function createFlysystem(FlysystemAdapter $adapter, array $config) { if ($config['read-only'] ?? false === true) { $adapter = new ReadOnlyFilesystemAdapter($adapter); } return new Flysystem($adapter, Arr::only($config, [ 'directory_visibility', 'disable_asserts', 'temporary_url', 'url', 'visibility', ])); }
3. Scoped
filesystem driver for versioning with prefix
:
Frank de Jonge contributed by adding scoped driver option in disk configurations to create a version or option to use the prefix for the storage paths of the existing s3 driver.
Occasionally, files are stored on a single filesystem (e.g. S3) using at different storage paths locations. This base path needs to be kept throughout the website. The scoped driver makes it easy to re-use disk configurations, and decorated the internal adapter.
Consider the following with an existing s3 disk:
'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, ],
After using the new scoped driver:
's3_videos' => [ 'driver' => 'scoped', 'prefix' => 'path/for/videos', 'disk' => 's3', ],
=> Configuring, storing, and fetching the files:
$local = $filesystem->disk('local'); $scoped = $filesystem->build([ 'driver' => 'scoped', 'disk' => 'local', 'prefix' => 'path-prefix', ]); $scoped->put('dirname/filename.txt', 'file content'); // store file with scoped prefix location $local->get('path-prefix/dirname/filename.txt'); // to get file with prefix
Source File Edits: src/Illuminate/Filesystem/FilesystemManager.php
/** * @param array $config * @return \Illuminate\Contracts\Filesystem\Filesystem */ public function createScopedDriver(array $config) { if (empty($config['disk'])) { throw new InvalidArgumentException("Missing disk for scoped driver."); } if (empty($config['prefix'])) { throw new InvalidArgumentException("Prefix is missing for scoped driver."); } $diskConfig = $this->getConfig($config['disk']); $diskConfig['prefix'] = $config['prefix']; return $this->build($diskConfig); } /** * Create a Flysystem instance with the given adapter. * * @param \League\Flysystem\FilesystemAdapter $adapter * @param array $config * @return \League\Flysystem\FilesystemOperator */ protected function createFlysystem(FlysystemAdapter $adapter, array $config) { ... if (! empty($config['prefix'])) { $adapter = new PathPrefixedAdapter($adapter, $config['prefix']); } return new Flysystem($adapter, Arr::only($config, [ 'directory_visibility', 'disable_asserts', 'temporary_url', 'url', 'visibility', ])); }
4. force -f
options for artisan make commands:
James Brooks contributed by adding the --force
option to all make:*
commands. Previously, this option is available for only few make commands. Now, you can use this option for any make command, this will Create the class even if the cast already exists.
Source File Edits: src/Illuminate/Foundation/Console/ChannelMakeCommand.php
/** * Get the console command arguments. * * @return array */ protected function getOptions() { return [ ['force', 'f', InputOption::VALUE_NONE, 'Create the class even if the channel already exists'], ]; }
Now the list of the Laravel 9.30 Released updates:
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)
To get to know more about Laravel, you can check these articles too.
You can check the latest release tech articles like Laravel 9.30 Released here.