Winter CMS is updating its foundation framework to the latest release. As a result, there are some new requirements to run Winter and some code changes required.
From Build 1.3.0 your webserver will require PHP 8.2 or above to use Winter CMS. Websites using PHP 8.0 or 8.1 will still function normally but will no longer be able to receive updates or install the latest version.
There are various code changes that may be required, including code found in plugins and themes, both private and public depending on what features you are utilizing.
- Build 1.3.0 is available as a test update. Stable release date to be announced.
- PHP: 8.2+
- Composer: 2.2+
- curl: 7.34.0+
- MariaDB 10.3+ (Version Policy)
- MySQL 8.0+ (Version Policy)
- PostgreSQL 10.0+ (Version Policy)
- SQLite 3.26.0+ (up from 3.8.8)
- SQL Server 2017+ (Version Policy)
- Laravel: 12.x
- Carbon: 3.x (required, Carbon 2.x no longer supported)
- PHPUnit: 11.0 (for testing)
- Symfony: 7.x
NOTE: PHP 8.0 and 8.1 are now unsupported.
- Update the following
composer.jsonrequirements:
"require": {
"php": "^8.2",
"winter/storm": "~1.3.0",
"winter/wn-system-module": "~1.3.0",
"winter/wn-backend-module": "~1.3.0",
"winter/wn-cms-module": "~1.3.0",
"laravel/framework": "^12.0",
"wikimedia/composer-merge-plugin": "~2.0.1"
},
"require-dev": {
"phpunit/phpunit": "^11.0",
"mockery/mockery": "^1.6",
"fakerphp/faker": "^1.9.2",
"squizlabs/php_codesniffer": "^3.2",
"php-parallel-lint/php-parallel-lint": "^1.0",
"dms/phpunit-arraysubset-asserts": "^0.5"
},-
Run
composer update. -
Review and update your configuration files to match the latest defaults.
-
If using PHPUnit for testing, update your
phpunit.xmlconfiguration to the 10.5+ schema format.
The following first-party plugins require updates for compatibility with Winter CMS v1.3:
- Winter.Builder - See PR #71
- Winter.Docs - See PR #24
- Winter.Search - See PR #10
- Winter.Dusk - See PR #3
All other first-party plugins have been tested and confirmed compatible.
Any required code changes are described below in sections based on related functionality that you may or may not be using. If you are using the described functionality, please review the section and make the required changes.
Only potentially breaking changes are called out in this document. For the full list of all changes, please see the 1.3.0 release note.
If you are using any of the following functionality it's highly recommended that you take a look at the relevant section in this guide and make any required changes to your usage:
- PHP 8.5 Compatibility
- Console Commands
- Database & Schema
- Eloquent Models
- Authentication
- Carbon 3
- Rate Limiting
- Storage & Files
- Validation
- Unit Testing
- Configuration Files
- Storm Library Internals
- Using Laravel Packages
- Upgrade Guides
PHP 8.5 introduces native array_first() and array_last() functions that conflict with Winter's helper functions. If you are using these helpers with 2-3 arguments, you must switch to the Arr class methods:
Before (Winter < v1.3)
$first = array_first($array, function ($value, $key) {
return $value > 5;
});
$last = array_last($array, function ($value, $key) {
return $value > 5;
});After (Winter >= v1.3)
use Winter\Storm\Support\Arr;
$first = Arr::first($array, function ($value, $key) {
return $value > 5;
});
$last = Arr::last($array, function ($value, $key) {
return $value > 5;
});Due to Symfony 7.2 changes, the -s short option for --silent has been removed from asset compilation commands (mix:compile, npm:*, vite:*). Use the full --silent flag instead.
Before (Winter < v1.3)
php artisan mix:compile -sAfter (Winter >= v1.3)
php artisan mix:compile --silentThe static $defaultName property on console commands is deprecated. Use the AsCommand attribute instead:
Before (Winter < v1.3)
class MyCommand extends Command
{
protected static $defaultName = 'my:command';
protected $signature = 'my:command {argument}';
}After (Winter >= v1.3)
use Symfony\Component\Console\Attribute\AsCommand;
#[AsCommand(name: 'my:command')]
class MyCommand extends Command
{
protected $signature = 'my:command {argument}';
}Note: While Laravel 11 changed column modification behavior to no longer preserve existing attributes, Winter CMS v1.3 retains the previous behavior. Existing column attributes (nullable, default, unsigned, etc.) are automatically preserved when using
->change()unless you explicitly override them. No changes to your existing migrations are required.
Remove the $total and $places parameters from double and float column definitions:
Before (Winter < v1.3)
$table->double('amount', 8, 2);
$table->float('amount', 8, 2);After (Winter >= v1.3)
$table->double('amount');
$table->float('amount', precision: 53);
// For unsigned, use method chaining:
$table->double('amount')->unsigned();Specific spatial column methods have been replaced with generic ones:
Before (Winter < v1.3)
$table->point('coordinates');
$table->polygon('shapes');After (Winter >= v1.3)
$table->geometry('coordinates');
$table->geography('coordinates');
$table->geometry('shapes', subtype: 'polygon', srid: 0);Schema::getTables() and Schema::getTableListing() now return schema-qualified names by default:
Before (Winter < v1.3)
$tables = Schema::getTableListing();
// Returns: ['migrations', 'users', 'posts']After (Winter >= v1.3)
$tables = Schema::getTableListing();
// Returns: ['main.migrations', 'main.users', 'main.posts']
// To get unqualified names:
$tables = Schema::getTableListing(schema: 'main', schemaQualified: false);
// Returns: ['migrations', 'users', 'posts']Database expressions no longer support string casting:
Before (Winter < v1.3)
$expression = DB::raw('select 1');
$string = (string) $expression;After (Winter >= v1.3)
$expression = DB::raw('select 1');
$string = $expression->getValue(DB::connection()->getQueryGrammar());The HasUuids trait now generates UUID v7 (time-ordered) instead of UUID v4 (random):
To keep using UUID v4:
use Illuminate\Database\Eloquent\Concerns\HasVersion4Uuids as HasUuids;
class MyModel extends Model
{
use HasUuids;
}New default (UUID v7):
use Illuminate\Database\Eloquent\Concerns\HasUuids;
class MyModel extends Model
{
use HasUuids;
}The $dates property has been removed. Use $casts instead:
Before (Winter < v1.3)
class MyModel extends Model
{
protected $dates = ['published_at', 'deleted_at'];
}After (Winter >= v1.3)
class MyModel extends Model
{
protected $casts = [
'published_at' => 'datetime',
'deleted_at' => 'datetime',
];
}Laravel 12 introduces automatic password rehashing on login. A new configuration option has been added:
config/hashing.php
return [
// ... existing config ...
'rehash_on_login' => false, // Set to true to enable automatic rehashing
];If your user model uses a custom password column name, implement the new getAuthPasswordName() method:
class User extends Model implements Authenticatable
{
public function getAuthPasswordName()
{
return 'custom_password_column';
}
}Carbon 3 is now required. Carbon 2.x support has been removed.
diffIn* methods now return floats and can return negative values for past dates:
Before (Carbon 2.x)
$diff = $date->diffInDays($otherDate);
// Always returned positive integerAfter (Carbon 3.x)
$diff = $date->diffInDays($otherDate);
// Returns float, negative if $date is after $otherDate
// To get absolute value like before:
$diff = abs($date->diffInDays($otherDate));
// Or use the absolute parameter:
$diff = $date->diffInDays($otherDate, absolute: true);See the Carbon 3 changelog for full details.
Rate limiting classes now accept seconds instead of minutes:
Before (Winter < v1.3)
use Illuminate\Queue\Middleware\ThrottlesExceptions;
// 2 minutes
return [(new ThrottlesExceptions($maxAttempts, 2))];
// GlobalLimit and Limit also used minutes
new GlobalLimit($maxAttempts, 2); // 2 minutes
new Limit($key, $maxAttempts, 2); // 2 minutesAfter (Winter >= v1.3)
use Illuminate\Queue\Middleware\ThrottlesExceptions;
// Convert to seconds (2 minutes = 120 seconds)
return [(new ThrottlesExceptions($maxAttempts, 2 * 60))];
// GlobalLimit and Limit now use seconds
new GlobalLimit($maxAttempts, 120); // 120 seconds
new Limit($key, $maxAttempts, 120); // 120 secondsThe default local disk root path has changed:
Before (Winter < v1.3)
storage/app
After (Winter >= v1.3)
storage/app/private
To restore the previous behavior, update config/filesystems.php:
'disks' => [
'local' => [
'driver' => 'local',
'root' => storage_path('app'), // Restore old path
],
],SVG images are no longer allowed by default in image validation rules:
Before (Winter < v1.3)
// SVGs were allowed
'photo' => 'required|image'After (Winter >= v1.3)
// To explicitly allow SVGs:
'photo' => 'required|image:allow_svg'
// Or using the File class:
use Illuminate\Validation\Rules\File;
'photo' => ['required', File::image(allowSvg: true)],PHPUnit 11 is now required for testing. Key changes:
- PHPUnit configuration must use the 10.5+ schema format
- Docblock annotations are replaced with PHP 8 attributes
- Data providers must be static methods
Before (PHPUnit 9/10)
/**
* @dataProvider provideTestData
* @depends testSomethingFirst
*/
public function testSomething($data)
{
// ...
}
public function provideTestData()
{
return [
['value1'],
['value2'],
];
}After (PHPUnit 11)
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\Attributes\Depends;
#[DataProvider('provideTestData')]
#[Depends('testSomethingFirst')]
public function testSomething($data)
{
// ...
}
public static function provideTestData(): array
{
return [
['value1'],
['value2'],
];
}Update your phpunit.xml to remove deprecated options and add caching:
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
bootstrap="vendor/autoload.php"
cacheDirectory=".phpunit.cache"
colors="true">
<!-- ... -->
</phpunit>Review and update your configuration files to match the latest defaults:
- Added
previous_keysconfiguration for encryption key rotation (usesAPP_PREVIOUS_KEYSenvironment variable) debugvalue is now cast to boolean
- Added
rehash_on_loginoption (defaults tofalse)
Version 1.3 of Winter includes significant refactoring of the Storm library for Laravel 12 compatibility:
- New PDO Layer: Introduces
Winter\Storm\Database\PDO\Connectionwrapper with driver-specific implementations (MySql, Postgres, SQLite, SqlServer) - Connection Classes: New driver-specific connection classes (
MySqlConnection,MariaDbConnection,PostgresConnection,SQLiteConnection,SqlServerConnection) - HasConnection Trait: Connection logic extracted to
HasConnectiontrait - Schema Grammars: New MariaDB-specific grammar; all grammars support
compileChangemethod
setUser()method on Auth Manager now returnsstatic(fluent interface)- Dynamic password column support via
getAuthPasswordName()method
paginate()method accepts optional$totalparametersearchWhereInternal()properly handlesExpressioninstances
publicPath($path='')now accepts optional subpath parameter- Registers Laravel 11's
ContextServiceProvider $routeMiddlewareproperty renamed to$middlewareAliases
The version of Laravel has been changed from 9.x LTS to 12.x. If you are using packages made for Laravel you may have to update them to a version compatible with Laravel 12.x.
Common package updates required:
| Package | Winter 1.2 Version | Winter 1.3 Version |
|---|---|---|
| laravel/cashier | ^14.0 | ^15.0 |
| laravel/passport | ^11.0 | ^12.0 |
| laravel/sanctum | ^3.0 | ^4.0 |
| laravel/telescope | ^4.0 | ^5.0 |
| laravel/dusk | ^7.0 | ^8.0 |
| laravel/scout | ^9.0 | ^10.0 |
The following external upgrade guides may be helpful: