定制 pogo/symfony-queue 二次开发

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

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

pogo/symfony-queue

最新稳定版本:v0.0.9

Composer 安装命令:

composer require pogo/symfony-queue

包简介

FrankenPHP Queue Driver for Symfony Messenger

README 文档

README

A FrankenPHP Messenger transport for Symfony.

This bundle allows you to use the experimental pogo_queue module from as a native Symfony Messenger transport. It provides an ultra-fast, in-memory queue system.

Requirements

  • PHP 8.5+
  • Symfony 8.0
  • FrankenPHP binary compiled with the pogo_queue module enabled.

Installation

composer require pogo/symfony-queue

Configuration

2. Configure Messenger

Open config/packages/messenger.yaml and configure the transport.

framework:
    messenger:
        transports:
            pogo: 'pogo-queue://default'
            
        routing:
            'App\Message\YourMessage': pogo

in your .env


FrankenPHP Setup

To enable the worker, you need a specific Caddyfile and a worker entry point script (queue-worker.php) at the root of your project.

1. The Worker Script (queue-worker.php)

Create a file named queue-worker.php in public folder.

Note: We use ArrayInput to explicitly tell the worker which transport to consume (pogo in this example).

<?php

use App\Kernel;
use Symfony\Bundle\FrameworkBundle\Console\Application;
use Symfony\Component\Console\Input\ArrayInput;

if (!is_dir(__DIR__ . '../vendor')) {
    throw new LogicException('Dependencies are missing. Try running "composer install".');
}

if (!is_file(__DIR__ . '../vendor/autoload_runtime.php')) {
    throw new LogicException('Symfony Runtime is missing. Try running "composer require symfony/runtime".');
}

require_once __DIR__ . '../vendor/autoload_runtime.php';

return function (array $context) {
    $kernel = new Kernel($context['APP_ENV'], (bool) $context['APP_DEBUG']);

    $app = new Application($kernel);

    // Set the default command to consume messages
    $app->setDefaultCommand('messenger:consume', true);

    $input = new ArrayInput([
        'receivers' => ['pogo'],
        '--limit' => 1000,
        '--time-limit' => 3600
    ]);

    $app->run($input);

    return $app;
};

2. The Caddyfile

Create a Caddyfile at the root of your project. This configuration enables the pogo_queue worker and serves the Symfony application.

{
    frankenphp
    # Configure the queue worker module
    pogo_queue {
        worker public/queue-worker.php
    }
}

:8000 {
    root public

    @phpRoute {
        not file {path}
    }
    rewrite @phpRoute index.php

    @frontController path index.php
    php @frontController

    file_server {
        hide *.php
    }
}

Usage

Start FrankenPHP using the configuration file:

frankenphp run --config Caddyfile

You should see logs indicating that the worker has started: [OK] Consuming messages from transport "pogo".

Troubleshooting & Known Limitations

  1. "No transport supports Messenger DSN...":

    • Ensure you have registered the FrankenPHPQueueTransportFactory in your config/services.yaml.
    • Ensure your DSN in messenger.yaml starts exactly with pogo-queue://.
  2. Volatile Memory:

    • Warning: This transport is in-memory. If you restart FrankenPHP, all pending messages in the queue are lost. Do not use this for critical data that must persist across restarts.
  3. Logs:

    • The worker output (logs) will appear in the main FrankenPHP console window.

统计信息

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

GitHub 信息

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

其他信息

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

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固