Download the PHP package hyperf/xxl-job-incubator without Composer

On this page you can find all versions of the php package hyperf/xxl-job-incubator. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package xxl-job-incubator

xxl-job-incubator

此为 xxl-job 的 PHP 版本的任务执行器(Job Executor),特别适配于 Hyperf 框架,其余框架尚未验证适配性

优点

使用须知

  1. xxl-job 服务端版本需 >= 2.2.0
  2. 阻塞处理策略:单机串行(未实现),任务默认并行执行; 对于长时间的任务,建议使用丢弃后续调度

安装

使用

配置

配置文件: config/autoload/xxl_job.php

如文件不存在可通过以下命令发布配置文件

Bean 模式(类形式)

Bean 模式任务,支持基于类的开发方式,每个任务对应一个 PHP 类

优点:与 Hyperf 整合性好,易于管理 缺点:任务运行于单独的,协程任务代码不能存在阻塞 IO,每个 Job 需占用一个类文件,Job 逻辑简单但数量过多时过于累赘

swoole默认使用命令行模式执行,swow默认使用协程模式执行 如需要手动指定模式,执行器名称后缀为process(忽略大小写),使用命令行模式执行;后缀为coroutine(忽略大小写),使用协程执行 swoole使用协程模式,无法使用:关闭终止任务|以及阻塞处理策略|任务超时

编写 Job 类

编写一个实现 Hyperf\XxlJob\Handler\JobHandlerInterface 的 Job 类,并为 Job 类添加注解 #[XxlJob('value')],注解的 value 值对应的是调度中心新建任务的 JobHandler 属性的值,如下所示:

Tips: 可直接继承 Hyperf\XxlJob\Handler\AbstractJobHandler 得到对应的实现

在调度中心新建调度任务

对新建的任务进行参数配置,运行模式选中 BEAN模式,JobHandler 属性填写注解 #[XxlJob]中定义 value 值 hMvJnQ

Bean 模式(方法形式)

基于方法的开发方式,每个任务对应一个方法

优点:相对比 Bean(类形式) 更加灵活
缺点:数量多时更难管理,代码复杂度高时多个任务间容易造成耦合度过高

编写 Job 方法

对任意类中的 Public 方法增加 #[XxlJob('value')] 注解,注解的 value 值对应的是调度中心新建任务的 JobHandler 属性的值

在调度中心新建调度任务

对新建的任务进行参数配置,运行模式选中 BEAN模式,JobHandler 属性填写注解 #[XxlJob]中定义 value 值 hMvJnQ

使用案例

Glue 脚本模式

该模式下,可支持任务以将源码方式维护在调度中心,支持通过 XXL-JOB 提供的 Web IDE 在线编写代码和在线更新,因此不需要指定固定的 JobHandler
脚本模式支持多种脚本语言编写 Job 代码,包括 PHP、Python、NodeJs、Shell、PowerShell,在 XXL-JOB 新建任务时选择对应的模式即可,例如 GLUE(PHP) 即代表 PHP 语言的脚本模式,所有脚本模式的任务会以一个独立的进程来运行,故在 PHP 下也可支持编写存在 IO 阻塞的代码

要使用 Glue 脚本模式 必须配置 Access Token 方可启用

优点:极度灵活,可以实现不重启新增和修改 Job 代码,支持多种脚本语言,独立进程
缺点:大批量任务时容易造成进程数过多,脚本代码由 XXL-JOB 远程编辑发放容易导致安全问题,Job 代码可对 Executor 所在服务器环境进行与启动 Hyperf 应用的权限相同的操作

安装xxl-job-admin(2.4.0版本)

初始化“调度数据库”

初始化SQL脚本

docker安装

替换:数据库地址/账号/密码和accessToken

引用

关于 XXL-JOB 更多的使用细节可参考 XXL-JOB 官方文档


All versions of xxl-job-incubator with dependencies

PHP Build Version
Package Version
Requires php Version >=8.0
guzzlehttp/guzzle Version ^6.3|^7.0
hyperf/di Version ~3.0.0|~3.1.0
hyperf/event Version ~3.0.0|~3.1.0
hyperf/framework Version ~3.0.0|~3.1.0
hyperf/http-server Version ~3.0.0|~3.1.0
hyperf/logger Version ~3.0.0|~3.1.0
hyperf/command Version ~3.0.0|~3.1.0
jetbrains/phpstorm-attributes Version ^1.0
symfony/process Version ^5.4 || ^6.0 || ^7.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package hyperf/xxl-job-incubator contains the following files

Loading the files please wait ....