Skip to content

Drop Laravel 11 / PHP 8.2–8.3 support, fix async serialization bug#3

Merged
yannelli merged 14 commits intomainfrom
march2023-update
Mar 14, 2026
Merged

Drop Laravel 11 / PHP 8.2–8.3 support, fix async serialization bug#3
yannelli merged 14 commits intomainfrom
march2023-update

Conversation

@yannelli
Copy link
Copy Markdown
Owner

Summary

This is a major version release that drops support for Laravel 11 and PHP 8.2/8.3, targeting PHP 8.4+ and Laravel
12+ only
. It also fixes a critical serialization bug in the async queue system and cleans up several minor issues
across config and documentation.

Breaking Changes

  • PHP: Minimum version raised from ^8.2 to ^8.4
  • Laravel: Minimum version raised from ^11.0|^12.0 to ^12.0
  • Pest: Minimum version raised from ^2.34|^3.8.6 to ^3.8.6
  • Testbench: Minimum version raised from ^9.0|^10.0 to ^10.0

Bug Fixes

  • AsyncAttemptJob: Closures ($thenCallback, $catchCallback, and all closures within the configuration array)
    were not serializable, causing fatal errors when dispatching to non-sync queue drivers (Redis, SQS, database). All
    closures are now wrapped in Laravel\SerializableClosure\SerializableClosure (a3c4c35)
  • AsyncAttemptJob: delayCallback, catchHandlers, and finallyCallbacks from the builder configuration were
    silently dropped when reconstructing the AttemptBuilder inside the queued job (a3c4c35)
  • AsyncAttemptBuilder: Removed incorrect implements ShouldQueue — this class is a builder, not a queued job (
    a996fc1)
  • phpstan.neon.dist: Removed reference to non-existent database/ directory (55ec40f)
  • phpunit.xml.dist: Renamed placeholder "VendorName Test Suite" to "Attempt Test Suite" (fb91ee8)

Refactors

  • AttemptBuilder: Removed dead function_exists('defer') fallback — defer() is always available in Laravel
    12+ (59045a1)
  • AttemptContext: Switched from Carbon\Carbon to Illuminate\Support\Carbon to respect app-level Carbon
    customizations (d53ad29)

CI

  • Removed Laravel 11 / testbench 9 from the GitHub Actions test matrix (614a048)

Docs

  • Fixed incorrect async execution example in README — dispatch() returns void, not a chainable result. Documented
    dispatch() with then/catch callbacks and await() as separate usage patterns (dc3139a)

Migration Guide

Update your composer.json:

"require": {
    "yannelli/attempt": "^3.0"
}

Requirements:

  • PHP 8.4 or higher
  • Laravel 12.x

No API changes — all public methods remain the same. Only the runtime requirements have changed.

Test Plan

  • All 161 existing tests pass (332 assertions)
  • Verify async dispatch works on non-sync queue driver (Redis/database)
  • Verify CI matrix runs cleanly on PHP 8.4 + Laravel 12

yannelli and others added 11 commits March 13, 2026 20:49
…Laravel 12+

BREAKING CHANGE: Minimum PHP version is now 8.4, minimum Laravel version is 12.0.
Removed support for Pest 2.x, testbench 9.x, and related Laravel 11 dependencies.
Closures stored in AsyncAttemptJob were not serializable, causing failures
on non-sync queue drivers. Also restores missing delayCallback, catchHandlers,
and finallyCallbacks when rebuilding the AttemptBuilder from configuration.
…uilder

AsyncAttemptBuilder is a builder, not a queued job. The ShouldQueue interface
was misleading and belonged only on AsyncAttemptJob.
The defer() helper is always available in Laravel 12+, so the
fallback branch was dead code.
dispatch() returns void, not a pending result. Documented dispatch()
with then/catch callbacks and await() as separate usage patterns.
@yannelli yannelli self-assigned this Mar 14, 2026
Copilot AI review requested due to automatic review settings March 14, 2026 02:17
@yannelli yannelli added bug Something isn't working enhancement New feature or request labels Mar 14, 2026
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the package for a Laravel 12 / PHP 8.4 baseline and improves async attempt execution by making queued job configuration more serialization-friendly, alongside some documentation/config/test cleanups.

Changes:

  • Bump runtime/dev dependencies (PHP ^8.4, Illuminate ^12) and update CI matrix accordingly.
  • Update async attempt queuing implementation to serialize closures in job payload and restore more builder configuration when executing the job.
  • Clean up class references/imports in tests, config, and documentation.

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
tests/Unit/AttemptContextTest.php Switches Carbon reference to imported class.
tests/ArchTest.php Uses imports for arch expectations instead of fully-qualified names.
src/Facades/Attempt.php Updates @see reference to use imported AttemptManager.
src/Builders/AsyncAttemptJob.php Wraps closures for queue serialization; rehydrates builder config when handling job.
src/Builders/AsyncAttemptBuilder.php Removes ShouldQueue implementation from builder; keeps dispatch/await API.
src/AttemptContext.php Switches to Illuminate\Support\Carbon.
src/AttemptBuilder.php Simplifies deferred-callback scheduling to always call defer().
README.md Updates async usage docs with then/catch and adds await() example.
phpunit.xml.dist Renames the test suite.
phpstan.neon.dist Removes database from PHPStan scan paths.
config/attempt.php Uses imports for strategy class references.
composer.json Raises PHP/Laravel component requirements; updates dev tooling versions.
.github/workflows/run-tests.yml Narrows Laravel test matrix to 12.*.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +24 to +38
protected array $configuration;

protected ?SerializableClosure $thenCallback;

protected ?SerializableClosure $catchCallback;

public function __construct(
protected array $configuration,
protected ?Closure $thenCallback = null,
protected ?Closure $catchCallback = null
) {}
array $configuration,
?Closure $thenCallback = null,
?Closure $catchCallback = null
) {
$this->configuration = $this->wrapClosures($configuration);
$this->thenCallback = $thenCallback ? new SerializableClosure($thenCallback) : null;
$this->catchCallback = $catchCallback ? new SerializableClosure($catchCallback) : null;
}
@yannelli yannelli merged commit 5e45300 into main Mar 14, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants