Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Workerman Bundle Laravel Package

crazy-goat/workerman-bundle

Symfony bundle integrating Workerman to run a high-performance async HTTP server, scheduler and supervisor in pure PHP. Keeps the Symfony kernel/container alive between requests for faster apps. Supports SO_REUSEPORT and optional direct Request creation for speed.

View on GitHub
Deep Wiki
Context7

TriggerFactory Cron Expression Detection Fix

Date: 2026-04-14 Issue: #34 Status: Approved

Problem

TriggerFactory::create() uses a fragile heuristic to detect cron expressions:

is_string($expression) && count(explode(' ', $expression)) === 5 && str_contains($expression, '*')

This fails for valid cron expressions without asterisks, such as 0 0 1 1 1 (January 1st at midnight, on Monday).

Solution

Replace the fragile heuristic with CronExpression::isValidExpression() from the dragonmantank/cron-expression library, which is already a dependency.

Changes

File: src/Scheduler/Trigger/TriggerFactory.php

  1. Add import: use Cron\CronExpression;
  2. Replace lines 39-40 with single condition:
    is_string($expression) && CronExpression::isValidExpression($expression) => new CronExpressionTrigger($expression),
    

The str_starts_with($expression, '@') check is no longer needed because CronExpression::isValidExpression() handles alias expressions (@daily, @hourly, etc.).

Test Updates

File: tests/TriggerFactoryTest.php

  1. Add test case 0 0 1 1 1 to cronExpressionProvider
  2. Update testFivePartNonCronExpressionThrowsException - remove or adjust since 1 2 3 4 5 is now considered a valid cron expression by the library (which is correct - it's a valid cron expression for 1:02:03 on April 5th)

Verification

Run existing tests to ensure no regressions:

./vendor/bin/phpunit tests/TriggerFactoryTest.php
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
terminal42/code-quality-tools
codifyo/ts-generator-bundle
andydefer/laravel-cluster
testo/fiber
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity
christhompsontldr/laravel-inky