定制 pedhot-dev/prokerja 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

pedhot-dev/prokerja

Composer 安装命令:

composer require pedhot-dev/prokerja

包简介

A lightweight PHP job & queue framework

README 文档

README

ProKerja is a lightweight PHP job & queue framework focused on declaration-first task orchestration.

It provides a clean, minimal, and transparent job queue system built on top of PHP + SQLite + Symfony Console, without relying on heavy frameworks, magic containers, or hidden execution layers.

ProKerja is designed to be:

  • technically correct
  • predictable
  • framework-agnostic
  • usable in real projects

Any interpretation beyond what the system explicitly guarantees is outside its responsibility.

Core Concept

ProKerja separates declaration from realization.

  • Declaring a job means it is registered into the system
  • Realizing a job depends entirely on worker availability
  • The system does not promise execution, only orchestration

This is not a limitation.
This is the contract.

Features

  • Job declaration & dispatch
  • Persistent queue (SQLite)
  • Long-running worker process
  • Explicit job lifecycle:
    • pending
    • processing
    • completed
    • failed
  • Symfony Console–based CLI
  • Zero framework lock-in
  • No background magic

Requirements

  • PHP 8.0+
  • PDO with SQLite enabled
  • Composer

Installation

git clone https://github.com/Pedhot-Dev/ProKerja.git
cd prokerja
composer install
chmod +x bin/prokerja or php bin/prokerja

Basic Usage

1. Declare Jobs via CLI

php bin/prokerja declare:job

This command will:

  • create job entries
  • store them in the queue
  • return immediately

A successful declaration means:

  • the job exists
  • the job is persisted
  • the system acknowledges it

It does not mean the job has been executed.

2. Start Worker (Realization Process)

php bin/prokerja realization:start

This starts a blocking worker process that:

  • continuously checks the queue
  • processes pending jobs
  • updates job status

If the queue is empty, the worker will remain idle and wait.

3. View Queue Report

php bin/prokerja report

Example output:

ProKerja Report
pending: 10
processing: 0
completed: 2
failed: 0

This report reflects system state, not execution guarantees.

Creating Your Own Job

1. Create a Job Class

All jobs must implement JobInterface.

<?php

namespace App\Jobs;

use ProKerja\Contracts\JobInterface;

final class SendEmailJob implements JobInterface
{
    public function __construct(
        private int $userId
    ) {}

    public function handle(): void
    {
        // Do the actual work here
        file_put_contents(
            'worker.log',
            "Email sent to user {$this->userId}\n",
            FILE_APPEND
        );
    }

    public function payload(): array
    {
        return [
            'userId' => $this->userId,
        ];
    }
}

Rules for Jobs:

  • Must be instantiable from payload data
  • Must not perform work inside the constructor
  • All heavy work must be inside handle()

Dispatching Jobs (Vanilla PHP)

You can dispatch jobs without using the CLI.

<?php

require 'vendor/autoload.php';

use ProKerja\Queue\DeclarationQueue;
use ProKerja\Queue\Dispatcher;
use App\Jobs\SendEmailJob;

$queue = new DeclarationQueue(__DIR__ . '/prokerja.sqlite');
$dispatcher = new Dispatcher($queue);

$dispatcher->dispatch(
    new SendEmailJob(42)
);

echo "Job declared\n";

Dispatching:

  • does not execute the job
  • does not require a running worker
  • always returns immediately

Running Worker Without CLI (Vanilla)

<?php

require 'vendor/autoload.php';

use ProKerja\Queue\DeclarationQueue;
use ProKerja\Worker\Worker;

$queue = new DeclarationQueue(__DIR__ . '/prokerja.sqlite');
$worker = new Worker($queue);

$worker->run(function () {
    echo "Waiting for ecosystem readiness...\n";
});

This behaves exactly like realization:start.

Important Notes

SQLite Path Consistency

All entry points must use the same SQLite database path.

Recommended:

define('PROKERJA_DB', realpath(__DIR__ . '/prokerja.sqlite'));

Using different paths will result in:

  • jobs not being picked up
  • empty reports
  • inconsistent behavior

Design Principles

  • Explicit over implicit
  • No hidden execution
  • No automatic scaling assumptions
  • No promise of completion
  • Transparent failure states

If a job does not run, the system is still functioning correctly.

What ProKerja Is NOT

  • Not a Laravel Queue replacement
  • Not a distributed task system
  • Not a scheduler
  • Not a background daemon manager
  • Not a guarantee engine

If you need those features, use a different tool.

Philosophy

ProKerja guarantees registration, not realization.

It records intent, tracks state, and reports status. Execution depends entirely on environment readiness.

The framework does exactly what it claims — nothing more.

License

Copyright 2026 Pedhot-Dev

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

pedhot-dev/prokerja 适用场景与选型建议

pedhot-dev/prokerja 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 0 次下载、GitHub Stars 达 0, 最近一次更新时间为 2026 年 01 月 12 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 pedhot-dev/prokerja 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 pedhot-dev/prokerja 我们能提供哪些服务?
定制开发 / 二次开发

基于 pedhot-dev/prokerja 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: Apache-2.0
  • 更新时间: 2026-01-12