Drop support for Laravel 10, Laravel 11, and PHP 8.1

XMLWordPrintableJSON

    • Type: Task
    • Resolution: Unresolved
    • Priority: Unknown
    • None
    • Affects Version/s: None
    • Component/s: Laravel
    • None
    • None
    • PHP Drivers
    • None
    • None
    • None
    • None
    • None
    • None

      Motivation

      As of June 2026, the following versions have reached end of life:

      Version Release date Security fixes until PHP versions Status
      Laravel 10 February 14, 2023 February 7, 2025 8.1, 8.2, 8.3 EOL
      Laravel 11 March 12, 2024 March 12, 2026 8.2, 8.3, 8.4 EOL

      Source: https://laravelversions.com/en

      Laravel 12 (minimum supported going forward) requires PHP 8.2, so PHP 8.1 support can also be dropped.

      Currently supported Laravel versions:

      Version Security fixes until PHP versions
      Laravel 12 February 4, 2027 8.2, 8.3, 8.4, 8.5
      Laravel 13 March 17, 2028 8.3, 8.4, 8.5

      Code to remove or simplify

      src/Schema/BlueprintLaravelCompatibility.php

      The if (! property_exists(BaseBlueprint::class, 'connection')) conditional trait exists solely to support Laravel 10/11. With Laravel 12+ as the minimum, the entire if branch can be removed and the trait reduced to its else body.

      src/Connection.php

      Both getDefaultQueryGrammar() and getDefaultSchemaGrammar() contain method_exists($grammar, 'setConnection') guards because setConnection() was removed in Laravel 12. Remove both conditional blocks.

      src/Query/BuilderTimeout.php

      Conditional trait that defines the timeout() method and $timeout property only on older Laravel versions. Can be removed entirely.

      src/Eloquent/DocumentModel.php

      getStorableEnumValueFromLaravel11() method has a @todo Remove this method when support for Laravel 10 is dropped comment. Remove and call the framework method directly.

      src/Concerns/ManagesTransactions.php

      runCallbacksBeforeTransaction() contains a property_exists(Connection::class, 'beforeStartingTransaction') guard with a // ToDo: remove conditional once we stop supporting Laravel 10.x comment. Remove the guard.

      Tests

      • tests/Ticket/GH3328Test.php: Remove beforeStartingTransactionIsSupported() helper and all its call sites
      • tests/Query/GrammarTest.php and tests/Query/BuilderTest.php: Remove method_exists($grammar, 'setConnection') conditionals

      composer.json

      Tighten version constraints:

      • "php": "^8.1" to "^8.2"
      • All "illuminate/*": "^10.36|^11|^12|^13.0" to "^12|^13.0"
      • "orchestra/testbench": "^8.0|^9.0|^10.0|^11.0" to "^10.0|^11.0"

      PHPStan improvements

      Removing these compatibility shims eliminates several PHPStan baseline suppressions and resolves non-ignorable errors (e.g. property.missingNativeType on BlueprintLaravelCompatibility.php).

            Assignee:
            Rishabh Bisht
            Reporter:
            Jérôme Tamarelle
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: