The Laravel team released v12.3.0, which includes a new JSON Unicode cast type, check linked storage status in the about
command, native JSON and JSONB support in SQLite schemas, and more.
JSON Unicode Cast Type
@fuwasegu contributed a new json:unicode
cast type for Eloquent attributes that allows JSON encoding with JSON_UNESCAPED_UNICODE
:
protected $casts = [ 'data' => 'json:unicode',];
The Pull Request #54992 description explains when you might prefer this cast over the json
cast:
This [cast] makes it easier to store and retrieve JSON data without Unicode escaping (
\uXXXX
), which is particularly useful for applications that handle non-ASCII characters like Japanese, Chinese, or emojis.Currently, Eloquent's
json
cast escapes Unicode characters by default, making JSON-encoded attributes harder to read for humans and increasing the need for manual decoding. Developers often work around this by overriding accessors/mutators or manually using json_encode()...
about
Command
Add "Storage Linked" Check to the Adam Patterson contributed a section to the artisan about
command that shows the status of filesystems links. Given the following links in the filesystem.php
configuration file:
// config/filesystem.phpreturn [ 'links' => [ public_path('storage') => storage_path('app/public'), public_path('images') => storage_path('app/images'), ],];
The artisan about
command will show the status of these links:
$ php artisan about Storagepublic/images ................................................... NOT LINKEDpublic/storage .................................................. LINKED
Native JSON and JSONB Column Types in SQLite Schema
@fuwasegu contributed support for JSON and JSONB column types in SQLite schemas:
SQLite has supported JSON data type as a built-in feature since version 3.38.0, but prior to that, users needed to opt-in by installing an extension. Additionally, native support for JSONB type began with version 3.45.
Since Laravel 12 supports SQLite 3.26.0 and above, it should not be designed with the assumption that JSON/JSONB support is always available. While
Query\Grammars\SQLiteGrammar
includes support for JSON functions,Schema\Grammars\SQLiteGrammar
does not offer this option. This Pull request allows injecting configuration from the database connection config to enable the use of native JSON columns when defining Schema.
Here are the configuration options:
'sqlite' => [ 'driver' => 'sqlite', 'url' => env('DATABASE_URL'), ..., 'use_native_json' => true, 'use_native_jsonb' => true,],
This pull request does not change the default, however, if you want to use native JSON or JSONB columns, you can enable these options in your connection. See Pull Request #54991 for implementation details and discussion.
Support for PostgreSQL "unique nulls not distinct"
Thierry Parent contributed support for PostgreSQL (>= 15
) unique nulls not distinct when building unique indexes:
By adding support for a new
nullsNotDistinct()
fluent index definition method (see the unit tests for some examples) when using thepostgres
database driver (or more precisely when using the Postgres schema grammar).
Release notes
You can see the complete list of new features and updates below and the diff between 12.2.0 and 12.3.0 on GitHub. The following release notes are directly from the changelog:
v12.3.0
- [12.x] fixes https://github.com/laravel/octane/issues/1010 by @mihaileu in https://github.com/laravel/framework/pull/55008
- Added the missing 'trashed' event to getObservablesEvents() by @duemti in https://github.com/laravel/framework/pull/55004
- [12.x] Enhance PHPDoc for Manager classes with
@param-closure-this
by @kayw-geek in https://github.com/laravel/framework/pull/55002 - [12.x] Fix
PendingRequest
typehints forpost
,patch
,put
,delete
by @cosmastech in https://github.com/laravel/framework/pull/54998 - [12.x] Add test for untested methods in LazyCollection by @mohammadrasoulasghari in https://github.com/laravel/framework/pull/54996
- [12.x] fix indentation by @browner12 in https://github.com/laravel/framework/pull/54995
- [12.x] apply final Pint fixes by @browner12 in https://github.com/laravel/framework/pull/55014
- Enhance validation tests: Add test for connection name detection in Unique rule by @alikhosravidev in https://github.com/laravel/framework/pull/54993
- [12.x] Add json:unicode cast to support JSON_UNESCAPED_UNICODE encoding by @fuwasegu in https://github.com/laravel/framework/pull/54992
- [12.x] Add “Storage Linked” to the
about
command by @adampatterson in https://github.com/laravel/framework/pull/54949 - [12.x] Add support for native JSON/JSONB column types in SQLite Schema builder by @fuwasegu in https://github.com/laravel/framework/pull/54991
- [12.x] Fix
LogManager::configurationFor()
typehint by @cosmastech in https://github.com/laravel/framework/pull/55016 - [12.x] Add missing tests for LazyCollection methods by @mohammadrasoulasghari in https://github.com/laravel/framework/pull/55022
- [12.x] Refactor: Structural improvement for clarity by @AhmedAlaa4611 in https://github.com/laravel/framework/pull/55018
- Improve
toKilobytes
to handle spaces and case-insensitive units by @alikhosravidev in https://github.com/laravel/framework/pull/55019 - [12.x] Fix mistake in
asJson
call inHasAttributes.php
that was recently introduced by @AndrewMast in https://github.com/laravel/framework/pull/55017 - [12.x] reapply Pint style changes by @browner12 in https://github.com/laravel/framework/pull/55015
- Add validation test for forEach with null and empty array values by @alikhosravidev in https://github.com/laravel/framework/pull/55047
- [12.x] Types: EnumeratesValues Sum by @liamduckett in https://github.com/laravel/framework/pull/55044
- [12.x] Ensure Consistent Formatting in Generated Invokable Classes by @AhmedAlaa4611 in https://github.com/laravel/framework/pull/55034
- Add element type to return array in Filesystem by @AJenbo in https://github.com/laravel/framework/pull/55031
- [12.x] Add support for PostgreSQL "unique nulls not distinct" by @thierry2015 in https://github.com/laravel/framework/pull/55025
- [12.x] standardize multiline ternaries by @browner12 in https://github.com/laravel/framework/pull/55056
- [12.x] improved readability for
aliasedPivotColumns
by @browner12 in https://github.com/laravel/framework/pull/55055 - [12.x] remove progress bar from PHPStan output by @browner12 in https://github.com/laravel/framework/pull/55054
- [12.x] Fixes how the fluent Date rule builder handles
date_format
by @AndrewMast in https://github.com/laravel/framework/pull/55052 - Adding SSL encryption and support for MySQL connection by @mdiktushar in https://github.com/laravel/framework/pull/55048
- Revert "Adding SSL encryption and support for MySQL connection" by @taylorotwell in https://github.com/laravel/framework/pull/55057
- Ensure queue property is nullable by @timacdonald in https://github.com/laravel/framework/pull/55058
- [12.x] return
$this
for chaining by @browner12 in https://github.com/laravel/framework/pull/55060 - [12.x] prefer
new Collection
overcollect()
by @browner12 in https://github.com/laravel/framework/pull/55059 - [12.x] use "class-string" type for
using
pivot model by @browner12 in https://github.com/laravel/framework/pull/55053 - [12.x] multiline chaining on Collections by @browner12 in https://github.com/laravel/framework/pull/55061