snicco/better-wp-hooks-bundle

v2.0.0-beta.9 2024-09-07 14:27 UTC

README

codecov Psalm Type-Coverage Psalm level PhpMetrics - Static Analysis PHP-Versions

这个 WordPress 包配置了独立库 snicco/better-wp-hooks,以便在基于 snicco/kernel 的应用中使用。

安装

composer install snicco/better-wp-hooks-bundle

配置

此包目前没有配置选项。

用法

BetterWPHooksBundle 添加到您的 bundles.php 配置文件中。

<?php
// /path/to/configuration/bundles.php

use Snicco\Bundle\BetterWPHooks\BetterWPHooksBundle;
use Snicco\Component\Kernel\ValueObject\Environment;

return [
    
    'bundles' => [
        Environment::ALL => [
            BetterWPHooksBundle::class
        ]   
    ]   
];

您现在可以在内核启动后 惰性 解析以下服务

use Psr\EventDispatcher\EventDispatcherInterface;
use Snicco\Component\BetterWPHooks\EventMapping\EventMapper;
use Snicco\Component\EventDispatcher\EventDispatcher;


/**
* @var Kernel $kernel
*/
$kernel->boot();

$event_dispatcher = $kernel->container()->make(EventDispatcher::class);

$psr_event_dispatcher = $kernel->container()->make(EventDispatcherInterface::class);

var_dump($event_dispatcher === $psr_event_dispatcher); // true

$event_mapper = $kernel->container()->make(EventMapper::class);

如果已安装 snicco/event-dispatcher-testing 包,测试环境中将自动使用 TestableEventDispatcher

贡献

此存储库是 Snicco 项目 开发存储库的只读分割。

以下是您如何贡献的说明.

报告问题和发送拉取请求

请在 Snicco monorepo 中报告问题。

安全性

如果您在 BetterWPCache 中发现安全漏洞,请遵循我们的 披露程序