tourze/symfony-runtime-context-bundle 问题修复 & 功能扩展

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

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

tourze/symfony-runtime-context-bundle

最新稳定版本:1.0.1

Composer 安装命令:

composer require tourze/symfony-runtime-context-bundle

包简介

Symfony 上下文管理和延迟执行模块

README 文档

README

English | 中文

Latest Version Total Downloads PHP Version Require License Coverage Status

Context management module for Symfony applications, supporting deferred task execution and unique context identification.

Features

  • Obtain a unique ID for the current runtime context
  • Support for deferred (defer) task execution
  • Reset mechanism compatible with Symfony lifecycle
  • Extensible for different contexts (e.g., FPM, CLI)

Installation

  • Requires PHP 8.1+
  • Requires Symfony 6.4+ core components
  • Install via Composer:
composer require tourze/symfony-runtime-context-bundle

Quick Start

  1. Register the bundle in config/bundles.php:

    return [
        Tourze\Symfony\RuntimeContextBundle\RuntimeContextBundle::class => ['all' => true],
    ];
  2. Inject and use ContextServiceInterface:

    use Tourze\Symfony\RuntimeContextBundle\Service\ContextServiceInterface;
    
    public function index(ContextServiceInterface $contextService)
    {
        $id = $contextService->getId();
        $contextService->defer(function () {
            // Deferred task
        });
    }

Documentation

  • ContextServiceInterface: Defines the core context service interface, including unique ID retrieval, deferred execution, and coroutine support
  • DefaultContextService: Default implementation based on process ID or generated unique ID
  • DeferCallSubscriber: Event subscriber responsible for executing all deferred tasks at the end of the lifecycle

Contributing

  • Issues and PRs are welcome
  • Follow PSR-12 code style
  • Please ensure PHPUnit tests pass before submitting

License

  • MIT License
  • (c) tourze

Changelog

  • See CHANGELOG.md or commit history for details

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-04-17