tobento/app-job
Composer 安装命令:
composer require tobento/app-job
包简介
The app job lets you monitor queued or ran jobs from a web interface.
README 文档
README
The app job lets you monitor queued or ran jobs from a web interface.
Table of Contents
Getting Started
Add the latest version of the app job project running this command.
composer require tobento/app-job
Requirements
- PHP 8.4 or greater
Documentation
App
Check out the App Skeleton if you are using the skeleton.
You may also check out the App to learn more about the app in general.
Job Boot
The job boot does the following:
- installs and loads job config
- implements jobs interface
- boots features configured in job config
use Tobento\App\AppFactory; use Tobento\App\Job\JobRepositoryInterface; // Create the app $app = new AppFactory()->createApp(); // Add directories: $app->dirs() ->dir(realpath(__DIR__.'/../'), 'root') ->dir(realpath(__DIR__.'/../app/'), 'app') ->dir($app->dir('app').'config', 'config', group: 'config') ->dir($app->dir('root').'public', 'public') ->dir($app->dir('root').'vendor', 'vendor'); // Adding boots $app->boot(\Tobento\App\Job\Boot\Job::class); $app->booting(); // Implemented interfaces: $jobRepository = $app->get(JobRepositoryInterface::class); // Run the app $app->run();
You may install the App Backend and boot the job in the backend app.
Job Config
The configuration for the job is located in the app/config/job.php file at the default App Skeleton config location where you can configure features and more.
Features
Jobs Feature
The jobs feature provides a jobs page where users can see any jobs queued or ran. In addition, you may requeue failed or completed jobs again.
Config
In the config file you can configure this feature:
'features' => [ new Feature\Jobs( // A menu name to show the jobs link or null if none. menu: 'main', menuLabel: 'Jobs', // A menu parent name (e.g. 'system') or null if none. menuParent: null, // you may disable the ACL while testing for instance, // otherwise only users with the right permissions can access the page. withAcl: false, ), ],
ACL Permissions
jobsUser can access jobsjobs.requeueUser can requeue jobs.
If using the App Backend, you can assign the permissions in the roles or users page.
Monitor Jobs Feature
The monitor jobs feature records jobs using the job repository.
Config
In the config file you can configure this feature:
'features' => [ Feature\MonitorJobs::class, ],
Console
Purge Jobs Command
Use the following command to purge monitored jobs:
Purging jobs older than 24 hours
php ap jobs:purge
Available Options
| Option | Description |
|---|---|
--hours=24 |
The number of hours to retain jobs data. |
--queued=true |
If defined it purges only jobs which are queued (true) or not (false). |
--status=failed |
Purges only the jobs with the defined status. |
--appId[] |
Purges only the jobs which belongs to the defined app IDs. |
If you would like to automate this process, consider installing the App Schedule bundle and using a command task:
use Tobento\Service\Schedule\Task; use Butschster\CronExpression\Generator; $schedule->task( new Task\CommandTask( command: 'jobs:purge', ) // schedule task: ->cron(Generator::create()->daily()) );
Or you may install the App Task bundle and use the Command Task Registry to register this command.
Learn More
Monitor Jobs From Another App
When using different Apps, you may monitor jobs from all apps. Make sure that you configure the same job repository connection in the config file.
For instance, you may use the App Backend and configure it like:
'features' => [ Feature\Jobs::class, Feature\MonitorJobs::class, ], 'interfaces' => [ JobRepositoryInterface::class => static function(DatabasesInterface $databases, JobEntityFactory $entityFactory): JobRepositoryInterface { return new JobStorageRepository( storage: $databases->default('shared:storage')->storage()->new(), table: 'jobs', entityFactory: $entityFactory, ); }, ],
Next, if you have created another app:
'features' => [ // only monitor jobs: Feature\MonitorJobs::class, ], 'interfaces' => [ JobRepositoryInterface::class => static function(DatabasesInterface $databases, JobEntityFactory $entityFactory): JobRepositoryInterface { return new JobStorageRepository( storage: $databases->default('shared:storage')->storage()->new(), table: 'jobs', entityFactory: $entityFactory, ); }, ],
Finally, in the database config file, in both apps, configure the shared:storage database:
'defaults' => [ 'pdo' => 'mysql', 'storage' => 'file', 'shared:storage' => 'shared:file', ], 'databases' => [ 'shared:file' => [ 'factory' => \Tobento\Service\Database\Storage\StorageDatabaseFactory::class, 'config' => [ 'storage' => \Tobento\Service\Storage\JsonFileStorage::class, 'dir' => directory('app:parent').'storage/database/file/', ], ], ],
Credits
tobento/app-job 适用场景与选型建议
tobento/app-job 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 6 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 08 月 27 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「queue」 「package」 「app」 「job」 「tobento」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 tobento/app-job 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 tobento/app-job 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 tobento/app-job 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
PHP AMQP Binding Library
A Laravel package to monitor queue jobs.
Make your bundle an application
Simple ASCII output of array data
App Version Utility for CakePHP 2.x Applications
统计信息
- 总下载量: 6
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 22
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-08-27