syamsoul/laravel-action-delay
Composer 安装命令:
composer require syamsoul/laravel-action-delay
包简介
Delay a Job, Database Query or PHP code at a specific datetime easily with one simple command.
README 文档
README
Introduction
This package allows you to delay an action (Jobs, Database Query, PHP Code or External Process) at specific datetime with a simple command.
Requirement
- Laravel 10.x (and above)
Installation
This package can be used in Laravel 10.x or higher. If you are using an older version of Laravel, there's might be some problem. If there's any problem, you can create new issue and I will fix it as soon as possible.
You can install the package via composer:
composer require syamsoul/laravel-action-delay
Usage
You can delay an action via Artisan command.
php artisan souldoit:action-delay
Single-Line Commands (No Prompts)
You can delay actions using single-line commands without any interactive prompts. This is useful for automation, scripts, or when you want to schedule actions programmatically.
1. Delay Laravel Jobs
php artisan souldoit:action-delay --action=1 --job=\\SoulDoit\\ActionDelay\\Jobs\\ExternalProcessJob --job-parameter="touch newfile.txt" --delay-at="2025-06-25 16:25:00"
2. Delay Database Query
php artisan souldoit:action-delay --action=2 --db-query="INSERT INTO \`users\` (\`username\`,\`email\`,\`first_name\`,\`last_name\`,\`created_at\`,\`updated_at\`) VALUES ('user01','user01@gmail.com','User','One',NOW(),NOW())" --delay-at="2025-06-25 15:51:25"
3. Delay PHP Code
php artisan souldoit:action-delay --action=3 --php-code="\DB::table('users')->insert(['username'=>'user02', 'email'=>'user02@gmail.com', 'first_name'=>'User', 'last_name'=>'Two', 'updated_at'=>now(), 'created_at'=>now()])" --delay-at="2025-06-25 16:32:00"
4. Delay External Process
php artisan souldoit:action-delay --action=4 --command="php artisan down" --command-timeout=600 --delay-at="2025-06-25 16:37:50"
Available Options:
--action: Action type (1=Laravel Jobs, 2=Database Query, 3=PHP Code, 4=External Process)--job: Job class name (for action=1)--job-parameter: Job parameters (for action=1)--db-query: SQL query (for action=2)--php-code: PHP code to execute (for action=3)--command: Command to execute (for action=4)--command-timeout: Process timeout in seconds (for action=4, default: 600)--delay-seconds: Delay execution by specified number of seconds from current time--delay-at: Execution at specific date & time in UTC (format: Y-m-d H:i:s)
Interactive Prompts
1. Delay Laravel Jobs
What action you want to delay? [Laravel Jobs]: [1] Laravel Jobs [2] Database Query [3] PHP Code [4] External Process > 1 What job you want to delay? [App\Jobs\GenerateCertificate]: [1] App\Jobs\GenerateCertificate [2] App\Jobs\SendCongratulationsEmail > 2 Please insert #1 parameter: `user` (Type: App\Models\User): > \App\Models\User::find(1) Please insert #2 parameter: `text` (Type: string): > Congratulations on your success! What time to execute (in UTC time, format:Y-m-d H:i:s): > 2024-06-01 10:16:00
2. Delay Database Query
What action you want to delay? [Laravel Jobs]: [1] Laravel Jobs [2] Database Query [3] PHP Code [4] External Process > 2 Enter MySQL query: > UPDATE `variables` SET `_value`='false' WHERE `_key`='maintainance_mode_enabled' What time to execute (in UTC time, format:Y-m-d H:i:s): > 2024-06-01 08:30:35
3. Delay PHP Code
What action you want to delay? [Laravel Jobs]: [1] Laravel Jobs [2] Database Query [3] PHP Code [4] External Process > 3 Enter PHP code: > \App\Models\Variable::where('_key', 'maintainance_mode_enabled')->update(['_value' => 'false']); \App\Models\Variable::where('_key', 'new_feature_enabled')->update(['_value' => 'true']); What time to execute (in UTC time, format:Y-m-d H:i:s): > 2024-06-01 08:30:35
4. Delay External Process
What action you want to delay? [Laravel Jobs]: [1] Laravel Jobs [2] Database Query [3] PHP Code [4] External Process > 4 Enter command: > sh deploy Process timeout [600]: #default is 600 seconds, enter to choose default value > What time to execute (in UTC time, format:Y-m-d H:i:s): > 2024-06-01 08:30:35
Support me
If you find this package helps you, kindly support me by donating some BNB (BSC) to the address below.
0x364d8eA5E7a4ce97e89f7b2cb7198d6d5DFe0aCe
License
The MIT License (MIT). Please see License File for more information.
syamsoul/laravel-action-delay 适用场景与选型建议
syamsoul/laravel-action-delay 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 171 次下载、GitHub Stars 达 1, 最近一次更新时间为 2024 年 06 月 01 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「database」 「php」 「command」 「laravel」 「job」 「action」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 syamsoul/laravel-action-delay 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 syamsoul/laravel-action-delay 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 syamsoul/laravel-action-delay 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Dibi is Database Abstraction Library for PHP
A Wrapper for exec and it's results
Symfony bundle to monitor and execute commands
Store your language lines in the database, yaml or other sources
Shell command module for PHP.
A package for automatically encrypting and decrypting Eloquent attributes in Laravel 5.5+, based on configuration settings.
统计信息
- 总下载量: 171
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 20
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-06-01