Laravel 11.28 Adds a Composer Dev Command
Last updated on by Paul Redmond
Laravel 11.28 Released
This week, the Laravel team released v11.28, with a composer run dev
command, Tailwind default config, a "CollectedBy" attribute to define a custom Collection class for a model, interactive encrypt/decrypt commands, and more.
composer run dev
Command
Add Tailwind and Taylor Otwell updated the laravel/laravel
application repo with a composer run dev
command for all new applications. In the same pull request, every new Laravel application has a tailwind.config.js
. Having a Tailwind config lets you start using it immediately without installing any starter kit. This is great news for anyone who wants to tinker with Tailwind without any additional setup.
See Pull Request #6463 for details.
Add CollectedBy Attribute
Andreas Alsterholm contributed a CollectedBy
attribute for specifying a custom collection class for a model:
With this attribute added, one would only have to add the attribute rather than override the
newCollection()
method on the Model class.
Here's an example from the pull request:
use Illuminate\Database\Eloquent\Attributes\CollectedBy; #[CollectedBy(PostCollection::class)]class Post{ // ...}
env:encrypt
and env:decrypt
Commands
Interactive Harm Hermsen contributed interactive support for the env:encrypt
and env:decrypt
commands. The encrypt command prompts the user to either generate a random key or enter an existing one to use for encryption. The decrypt command allows you to paste in the key using a prompt and password field.
env:encrypt
env:decrypt
defaultLocale()
and defaultCurrency()
Helpers to the Number Facade
Add Ryan Holton contributed two new methods to the Number
facade for getting whatever the default locale and currency values are:
Number::defaultLocale(); // returns default localeNumber::defaultCurrency(); // returns default currency
Release notes
You can see the complete list of new features and updates below and the diff between 11.27.0 and 11.28.0 on GitHub. The following release notes are directly from the changelog:
v11.28.0
- [11.x] Update Authorizable methods with BackedEnum support by @bastien-phi in https://github.com/laravel/framework/pull/53079
- [11.x] Use
null
as default cursor value for PHP Redis by @jayan-blutui in https://github.com/laravel/framework/pull/53095 - [11.x] PHPDoc Improvements by @schulerj89 in https://github.com/laravel/framework/pull/53097
- [11.x] Fix resource not escaped correctly in substituteBindingsIntoRawSql() by @aedart in https://github.com/laravel/framework/pull/53100
- [11.x] feat: add useful defaultLocale and defaultCurrency helpers to Number facade by @sts-ryan-holton in https://github.com/laravel/framework/pull/53101
- [11.x] Fix determining pivot timestamp column name(s) when parent relation missing one or both of timestamps by @daniser in https://github.com/laravel/framework/pull/53103
- [11.x] Add phpstan assertions for last in Collection isEmpty and isNotEmpty by @bastien-phi in https://github.com/laravel/framework/pull/53107
- feat: interactive env:encrypt & env:decrypt by @hhermsen in https://github.com/laravel/framework/pull/53081
- [11.x] PHPDoc Improvements by @schulerj89 in https://github.com/laravel/framework/pull/53109
- [11.x] Feat: remove HasFactory in model when not required by @MrPunyapal in https://github.com/laravel/framework/pull/53104
- [11.x] Add
Illuminate\Support\enum_value
to resolveBackedEnum
orUnitEnum
to scalar by @crynobone in https://github.com/laravel/framework/pull/53096 - [11.x] allow guessing of nested component by @browner12 in https://github.com/laravel/framework/pull/52669
- [11.x] Introduce RouteParameter attribute by @bastien-phi in https://github.com/laravel/framework/pull/53080
- [11.x] Refactored to use enum_value() in castBinding() by @toarupg0318 in https://github.com/laravel/framework/pull/53131
- [11.x] Test Improvements remove code duplication by @toarupg0318 in https://github.com/laravel/framework/pull/53128
- Revert "[11.x] Test Improvements remove code duplication" by @taylorotwell in https://github.com/laravel/framework/pull/53132
- [11.x] Fix HasManyThrough::one() by @staudenmeir in https://github.com/laravel/framework/pull/53119
- [11.x] Console supports Laravel Prompts 0.3+ by @edjw in https://github.com/laravel/framework/pull/53136
- [11.x] PHPDoc Improvements by @xurshudyan in https://github.com/laravel/framework/pull/53139
- fix: make model command with folder path - factory incorrect import path by @JeRabix in https://github.com/laravel/framework/pull/53142
- [11.x] feat: refine return type for
throw_if
andthrow_unless
to reflect actual behavior with "falsey" values by @crishoj in https://github.com/laravel/framework/pull/53154 - [11.x] Ensure
where
with array respects boolean by @timacdonald in https://github.com/laravel/framework/pull/53147 - [11.x] Gracefully handle null passwords when verifying credentials by @gbradley in https://github.com/laravel/framework/pull/53156
- [11.x] feat: restore type-narrowing bahavior for
throw_*
helpers by @crishoj in https://github.com/laravel/framework/pull/53164 - [11.x] Add CollectedBy attribute by @alsterholm in https://github.com/laravel/framework/pull/53122
- [11.x] Add successful and failed methods to
ProcessPoolResults
by @Riley19280 in https://github.com/laravel/framework/pull/53160 - Issue with constrained() method used after foreignIdFor(), instead of table name when $table parameter is not passed uses column name by @granitibrahimi in https://github.com/laravel/framework/pull/53144