Skip to content

Add support php 8.4,8.5 and laravel 13.x#56

Closed
chienle wants to merge 1 commit intoandersao:masterfrom
chienle:feature/support-laravel-13
Closed

Add support php 8.4,8.5 and laravel 13.x#56
chienle wants to merge 1 commit intoandersao:masterfrom
chienle:feature/support-laravel-13

Conversation

@chienle
Copy link
Copy Markdown

@chienle chienle commented Mar 28, 2026

Laravel 13 & PHP 8.4/8.5 Support

Branch: feature/support-laravel-13
Commit: 702ea42
Date: March 28, 2026
Author: Lê Văn Chiến
Type: Compatibility Enhancement — No breaking changes


Overview

This change set extends prettus/laravel-validation to officially declare compatibility with Laravel 13 and PHP 8.4 / 8.5. All existing APIs, contracts, and validation behaviour remain fully backward-compatible back to Laravel 5.4 and PHP 7.1.

Additionally, it modernises the development toolchain by formally introducing PHPUnit 10/11 as a declared dev-dependency and removing deprecated PHPUnit XML configuration attributes that would cause warnings or failures on current PHPUnit versions.


Changed Files

1. composer.json

1.1 Package Description

-"description": "Laravel Validation Service",
+"description": "Laravel Validation Service — supports Laravel 5.4 to 13 and PHP 7.1 to 8.5",

The description was updated to immediately communicate the supported version range directly on Packagist, removing ambiguity for users browsing the registry.

1.2 PHP Version Constraint

-"php": ">=5.4.0",
+"php": "^7.1|^8.0|^8.4|^8.5",

Two changes are made here:

  1. Minimum PHP floor raised from >=5.4.0 to ^7.1 — PHP 5.4 through 7.0 have been end-of-life for years and are no longer tested or supported by any active Laravel version. Using an open-ended >= constraint allowed Composer to attempt resolution against EOL PHP versions, risking confusing errors. The explicit ^7.1 floor now matches the minimum requirement of the lowest still-supported Laravel versions accepted by this package.

  2. PHP 8.4 and 8.5 explicitly declared — Although the Composer semver constraint ^8.0 already resolves to any 8.x release (including 8.4 and 8.5), the explicit declarations serve two purposes: they clearly document which versions are actively targeted and tested, and they improve the Packagist compatibility matrix metadata used by users and automated tooling to discover packages.

1.3 illuminate/support Constraint

-"illuminate/support": "~5.4|^6.0|^7.0|^8.0|^9.0|^10.0|^11.0|^12.0",
+"illuminate/support": "~5.4|^6.0|^7.0|^8.0|^9.0|^10.0|^11.0|^12.0|^13.0",

1.4 illuminate/validation Constraint

-"illuminate/validation": "~5.4|^6.0|^7.0|^8.0|^9.0|^10.0|^11.0|^12.0",
+"illuminate/validation": "~5.4|^6.0|^7.0|^8.0|^9.0|^10.0|^11.0|^12.0|^13.0",

^13.0 was appended to both illuminate packages. These are the only two runtime dependencies of this package. All prior version constraints are preserved without modification to ensure full backward compatibility.

1.5 require-dev Section Added

+},
+"require-dev": {
+    "phpunit/phpunit": "^10.0|^11.0"
+},

phpunit/phpunit was previously undeclared in require-dev, meaning CI and contributors would receive whatever version Composer resolved transitively. It is now explicitly pinned to ^10.0|^11.0 to:

  • Ensure a consistent test runner across all environments.
  • Enable the updated phpunit.xml (see below) to properly resolve its XML Schema Definition at vendor/phpunit/phpunit/phpunit.xsd.
  • Align with PHPUnit versions that support PHP 8.1+.

2. phpunit.xml

The configuration file was modernised to remove attributes that have been removed or deprecated since PHPUnit 10, which would otherwise emit deprecation warnings or fatal errors when running the test suite.

Removed Attributes

Attribute Reason for Removal
backupGlobals="false" Removed in PHPUnit 10 — global backup is controlled via attributes on individual tests
backupStaticAttributes="false" Removed in PHPUnit 10 — same rationale as above
convertErrorsToExceptions="true" Removed in PHPUnit 10 — PHP 8 unified error handling makes this redundant
convertNoticesToExceptions="true" Removed in PHPUnit 10 — same rationale as above
convertWarningsToExceptions="true" Removed in PHPUnit 10 — same rationale as above
syntaxCheck="false" Removed in PHPUnit 8

Added: XSD Schema Reference

-<phpunit backupGlobals="false"
-         backupStaticAttributes="false"
+<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"

Adding the xsi:noNamespaceSchemaLocation reference enables IDE validation and auto-completion of phpunit.xml attributes, and produces a clear error when an unrecognised attribute is used in future configuration changes.

Final phpunit.xml:

<?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"
         colors="true"
         processIsolation="false"
         stopOnFailure="false"
>
    <testsuites>
        <testsuite name="Package Test Suite">
            <directory suffix=".php">./tests/</directory>
        </testsuite>
    </testsuites>
</phpunit>

3. .travis.yml

The CI test matrix was updated to reflect the new supported PHP range.

PHP Version Matrix

 php:
-  - 5.4
-  - 5.5
-  - 5.6
-  - hhvm
+  - 8.1
+  - 8.2
+  - 8.3
+  - 8.4
+  - 8.5

PHP 5.4, 5.5, 5.6 and HHVM were removed — all have been EOL for over a decade and are incompatible with both current Laravel and current PHPUnit. The matrix now covers the active PHP versions within the declared constraint range, starting from 8.1 (the oldest PHP version with active community support at the time of this change).

Test Runner Command

-script: phpunit
+script: vendor/bin/phpunit

The bare phpunit command relied on a globally installed binary, which is unreliable across CI environments. Using the vendor-local binary path is the standard practice for PHP projects and guarantees the explicitly declared version in require-dev is always the one being executed.


Resolved Dependency Verification

After running composer update --with-all-dependencies, Composer resolved the following key packages:

Package Resolved Version
illuminate/support v13.2.0
illuminate/validation v13.2.0
phpunit/phpunit 11.5.55

This confirms that the declared constraints correctly allow resolution to the latest Laravel 13 release.


Compatibility Matrix (Post-Change)

PHP Laravel Status
5.4 – 7.0 Dropped (EOL, constraint floor raised)
7.1 5.4 – 8.x Supported (legacy)
8.0 9.x – 12.x Supported
8.1 9.x – 13.x Supported
8.2 10.x – 13.x Supported
8.3 10.x – 13.x Supported
8.4 11.x – 13.x Newly declared
8.5 11.x – 13.x Newly declared

No Breaking Changes

Concern Impact
ValidatorInterface contract None
AbstractValidator public API None
LaravelValidator behaviour None
ValidatorException structure None
All prior Laravel versions (5.4–12) Continue to resolve as before

Migration Notes

No code changes are required in applications using this package. The update is purely additive to the version constraints.

To take advantage of Laravel 13 support, run:

composer update prettus/laravel-validation

@chienle chienle closed this Apr 23, 2026
@chienle chienle deleted the feature/support-laravel-13 branch April 23, 2026 04:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant