mkrmr/emphloyer-pdo 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

mkrmr/emphloyer-pdo

最新稳定版本:v0.6.0

Composer 安装命令:

composer require mkrmr/emphloyer-pdo

包简介

PDO backend for Emphloyer

README 文档

README

This extension provides a PDO backend for Emphloyer. This extension has only been tested with MySQL but likely works with other SQL databases as well.

NOTE: If you're replicating the MySQL database that holds you jobs table be sure to use MIXED or ROW based replication (STATEMENT based replication will generate tons of warnings because the backend uses UPDATE queries with a WHERE statement to lock jobs).

Installation

You can install Emphloyer-PDO through composer with:

composer require mkrmr/employer-pdo 

To use Employer-PDO you need to install the UUID pecl extension.

Usage

To use the PDO extension specify it as the backend in your configuration file like so:

$pipelineBackend = new \Emphloyer\Pdo\PipelineBackend("mysql:dbname=emphloyer_example;host=localhost", "user", "password");

If you want to use a specific table name for your jobs you can pass it to the constructor (emphloyer_jobs is the default):

$pdoAttributes = []; $pipelineBackend = new \Emphloyer\Pdo\PipelineBackend("mysql:dbname=emphloyer_example;host=localhost", "user", "password", $pdoAttributes, "emphloyer_jobs");

You also need to create the database table, in a MySQL database you would create the table like so:

CREATE table emphloyer_jobs ( uuid VARCHAR(36) PRIMARY KEY, created_at TIMESTAMP, run_from TIMESTAMP NULL DEFAULT NULL, locked_at TIMESTAMP NULL DEFAULT NULL, lock_uuid VARCHAR(36) UNIQUE, status VARCHAR(20), class_name VARCHAR(255), type VARCHAR(100), attributes TEXT );

If you want to use the Scheduler in addition to the Pipeline you need to add the following to the configuration file:

$schedulerBackend = new \Emphloyer\Pdo\SchedulerBackend("mysql:dbname=emphloyer_example;host=localhost", "user", "password");

If you want to use a specific table name for your jobs you can pass it to the constructor (emphloyer_scheduled_jobs is the default):

$pdoAttributes = []; $schedulerBackend = new \Emphloyer\Pdo\SchedulerBackend("mysql:dbname=emphloyer_example;host=localhost", "user", "password", $pdoAttributes, "emphloyer_scheduled_jobs");

You also need to create the database table, in a MySQL database you would create the table like so:

CREATE table emphloyer_scheduled_jobs ( id INT AUTO_INCREMENT, uuid VARCHAR(36) UNIQUE, created_at TIMESTAMP, locked_at TIMESTAMP NULL DEFAULT NULL, lock_uuid VARCHAR(36), class_name VARCHAR(255), attributes TEXT, minute TINYINT(1) DEFAULT NULL, hour TINYINT(1) DEFAULT NULL, monthday TINYINT(1) DEFAULT NULL, month TINYINT(1) DEFAULT NULL, weekday TINYINT(1) DEFAULT NULL, PRIMARY KEY (id) );

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Make your changes, please make sure you adhere to the Doctrine coding standard as much as possible (phpcs configuration is included)
  4. Commit your changes (git commit -am 'Add some feature')
  5. Push to the branch (git push origin my-new-feature)
  6. Create a new pull request on GitHub

统计信息

  • 总下载量: 37.48k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-01-04

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固