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

Scheduled Command Bundle Laravel Package

carles/scheduled-command-bundle

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture Fit

  • Pros:

    • Lightweight and focused on a single, niche use case (scheduled command execution via at).
    • Leverages Doctrine ORM for persistence, aligning with Laravel’s Eloquent (if adapted) or Symfony’s Doctrine integration.
    • Configurable via YAML, which can be mapped to Laravel’s .env or config/ files with minimal effort.
    • Uses Doctrine events for job creation, a pattern familiar to developers working with Laravel’s event system.
  • Cons:

    • Unix-only dependency: Relies on the at command, which is not natively available on Windows or some shared hosting environments (e.g., cPanel). This could limit deployment flexibility.
    • No active maintenance: Last release in 2020 raises concerns about compatibility with modern PHP/Laravel versions (e.g., PHP 8.x, Laravel 10+).
    • Tight coupling to Symfony: Assumes Symfony’s Doctrine setup; Laravel’s Eloquent would require significant adaptation (e.g., custom event listeners, model mappings).
    • No built-in retry/queueing: Unlike Laravel’s queue system, this bundle lacks resilience features (e.g., job retries, dead-letter queues).

Integration Feasibility

  • Laravel Compatibility:

    • Medium effort: The bundle’s core logic (scheduling via at) could be abstracted into a Laravel service, but Doctrine dependencies would need replacement (e.g., Eloquent models, Laravel’s event system).
    • Key challenges:
      • Replace Doctrine ORM with Eloquent for ScheduledCommand persistence.
      • Adapt Symfony’s event system to Laravel’s event system (e.g., scheduled_command.create → custom Laravel event).
      • Handle the at command execution via Laravel’s process utilities (e.g., Symfony/Process or Laravel\Process).
    • Alternatives: Laravel already has robust scheduling via artisan schedule (cron) or queue workers. This bundle offers no unique advantage unless at-specific features (e.g., one-time delayed jobs) are critical.
  • Technical Risk:

    • High: Risk of breaking changes due to outdated codebase (PHP 7.x likely), lack of tests, and Unix dependency.
    • Mitigation: Fork the repo to modernize it (e.g., PHP 8.1+, Laravel 10) before integration. Prioritize feature parity with Laravel’s native tools.
    • Critical Questions:
      • Why not use Laravel’s built-in scheduling (app/Console/Kernel.php) or queue system?
      • Are there specific at-command features (e.g., dynamic delays) that justify the integration?
      • What’s the fallback plan if at is unavailable (e.g., shared hosting)?

Key Questions for Stakeholders

  1. Business Requirements:
    • Are there compliance or operational constraints requiring at-specific scheduling (e.g., no cron access)?
    • How critical is cross-platform support (Windows/Linux)?
  2. Technical Trade-offs:
    • Would Laravel’s Bus or Schedule facade meet the same needs with lower risk?
    • Are there existing jobs that must use at (e.g., legacy system dependencies)?
  3. Maintenance:
    • Who will maintain this bundle long-term if issues arise?
    • What’s the plan for testing and CI/CD integration?

Integration Approach

Stack Fit

  • Laravel Alignment:

    • Low: The bundle is Symfony-centric. Laravel’s ecosystem (Eloquent, Artisan, queues) provides overlapping or superior functionality.
    • Potential Use Cases:
      • One-off delayed commands (e.g., "run this job in 30 minutes").
      • Environments where cron is restricted but at is available.
    • Alternatives to Evaluate:
      • Laravel’s Schedule facade (cron-based).
      • Queue workers with delay().
      • Third-party packages like spatie/scheduled-task (more maintained).
  • Tech Stack Requirements:

    • PHP 8.1+: Bundle may not support modern PHP features (e.g., named arguments, attributes).
    • Unix Environment: Mandatory for at command. Requires containerization (Docker) or cloud provider (AWS, GCP) with Unix-based instances.
    • Doctrine ORM: Not native to Laravel; would need replacement with Eloquent or a custom solution.

Migration Path

  1. Assessment Phase:
    • Audit existing scheduled jobs to determine if they can migrate to Laravel’s Schedule or queues.
    • Test at command availability in target environments (e.g., which at in CI/CD).
  2. Proof of Concept:
    • Fork the bundle and adapt it to Laravel:
      • Replace Doctrine with Eloquent models.
      • Replace Symfony events with Laravel events (Event::dispatch()).
      • Use Symfony/Process to execute at commands.
    • Example adapted ScheduledCommand model:
      namespace App\Models;
      use Illuminate\Database\Eloquent\Model;
      use Illuminate\Support\Facades\Process;
      
      class ScheduledCommand extends Model {
          protected $fillable = ['command', 'datetime'];
      
          public function schedule() {
              $process = new Process(['at', $this->datetime->format('H:mm'), $this->command]);
              $process->run();
              return $process->getOutput();
          }
      }
      
  3. Integration Steps:
    • Phase 1: Replace Doctrine persistence with Eloquent.
    • Phase 2: Implement a Laravel event listener to trigger at jobs on ScheduledCommand creation.
    • Phase 3: Add error handling (e.g., log failures if at is unavailable).
    • Phase 4: Deprecate old cron jobs in favor of the new system (if applicable).

Compatibility

  • PHP/Laravel Versions:
    • Risk: Bundle likely targets PHP 7.x. Test compatibility with PHP 8.1+ (e.g., type hints, constructor changes).
    • Workaround: Use a compatibility layer (e.g., php-compat) or patch the bundle.
  • Database:
    • Doctrine schema may not align with Laravel migrations. Custom migrations would be needed.
  • Operating System:
    • Blockers: Windows or at-unavailable environments require fallback logic (e.g., queue-based delays).

Sequencing

  1. Short-Term:
    • Evaluate if Laravel’s native tools suffice. If not, proceed with POC.
    • Containerize the app to ensure at availability (e.g., Docker with Unix-based images).
  2. Medium-Term:
    • Integrate the adapted bundle into Laravel’s event system.
    • Build a CLI command to manage scheduled jobs (e.g., php artisan schedule:at).
  3. Long-Term:
    • Monitor at job success/failure rates.
    • Plan to migrate to Laravel’s Schedule if at becomes unreliable.

Operational Impact

Maintenance

  • Effort:
    • High: Requires ongoing maintenance due to:
      • Outdated codebase (PHP 7.x, Symfony 4.x).
      • Custom Laravel adaptations (e.g., event listeners, Eloquent models).
      • Unix dependency (may need at updates or fallbacks).
    • Tasks:
      • Patch compatibility issues (e.g., PHP 8.1 deprecations).
      • Monitor at command reliability (e.g., system updates breaking at).
      • Update documentation for Laravel-specific usage.
  • Dependencies:
    • Tied to at command version and system libraries (e.g., libat on Linux).
    • Risk of silent failures if at is misconfigured or unavailable.

Support

  • Challenges:
    • Debugging: at jobs are opaque (no built-in logging). Requires custom logging (e.g., log at job IDs to database).
    • User Errors: Developers may misuse the bundle (e.g., scheduling long-running commands that block at).
    • Limited Community: No stars/dependents indicate low adoption; support may require internal triage.
  • Mitigations:
    • Add validation (e.g., command length limits, datetime constraints).
    • Implement health checks for at command availability.
    • Document fallbacks (e.g., "If at fails, use php artisan queue:work").

Scaling

  • Performance:
    • Limited: at has system-wide limits (e.g., max jobs per user). Not suitable for high-volume scheduling.
    • Bottlenecks:
      • at queue length (e.g., atq shows pending jobs).
      • File system I/O for temporary command files (configurable directory).
  • Horizontal Scaling:
    • Not applicable: at is a system-level service; scaling requires more at servers or alternative solutions (e.g., distributed task queues).
  • Alternatives for Scale:
    • Laravel queues with delay().
    • External services (e.g., AWS Step Functions, BullMQ).

Failure Modes

| Failure Scenario | Impact | Mitigation | |------------------------------------|-------------------------------------

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.
daikazu/eloquent-salesforce-objects
unseen-codes/chat
romalytar/yammi-jobs-monitoring-laravel
kisame76/filament-db-table-state
nqxcode/laravel-lucene-search
dpfx/laravel-livewire-wizards
workos/workos-php-laravel
sofa/laravel-global-scope
nawasara/auth-primitives
adhocrat-io/arkhe-main
make-dev/orca-harpoon
itsemon245/lamet
baks-dev/dashboard
amoifr/pickle-panther-bundle
make-dev/orca
dmstr/symfony-system-resources-bundle
dmstr/symfony-job-queue-bundle
dmstr/openapi-json-schema-bundle
dmstr/keycloak-security-bundle
dmstr/doctrine-audit-log-bundle