themeplate/process
Composer 安装命令:
composer require themeplate/process
包简介
ThemePlate background process
README 文档
README
Usage
use ThemePlate\Process\Async; // Instantiate $background = new Async( function() { long_running_task(); } ); // Dispatch $background->dispatch();
new Async( $callback_func, $callback_args )
Execute a heavy one-off task via a non-blocking request
- $callback_func (callable)(Required) Function to run asynchronously
- $callback_args (array)(Optional) Parameters to pass in the callback. Default
null
->dispatch()
Fire off the process in the background instantly
->then( $callback )
->catch( $callback )
Chainable methods to handle success or error
- $callback (callable)(Optional)
use ThemePlate\Process\Tasks; $chores = new Tasks( 'my_day' ); $chores->add( 'first_task', array( 'this', 'that' ) ); $chores->add( function() { another_task(); } );
new Tasks( $identifier )
- $identifier (string)(Required) Unique identifier
->add( $callback_func, $callback_args )
- $callback_func (callable)(Required) Function to run
- $callback_args (array)(Optional) Parameters to pass. Default
null
->remove( $callback_func, $callback_args )
- $callback_func (callable)(Required) Supposed function to run
- $callback_args (array)(Optional) The parameters passed. Default
null
->clear()
Remove all currently listed task
->limit( $number )
- $number (int)(Required) Number of task per run
->every( $second )
- $second (int)(Required) Interval between runs
->report( $callback )
- $callback (callable)(Required) To run after completion
Helper methods
->get_identifier()
->dump()
->is_running()
->next_scheduled()
->has_queued()
->get_queued()
themeplate/process 适用场景与选型建议
themeplate/process 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 176 次下载、GitHub Stars 达 0, 最近一次更新时间为 2020 年 03 月 24 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 themeplate/process 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 themeplate/process 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 176
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 7
- 依赖项目数: 1
- 推荐数: 2
其他信息
- 授权协议: GPL-3.0-only
- 更新时间: 2020-03-24