jord-jd/fuzzy-events
最新稳定版本:v4.0.0
Composer 安装命令:
composer require jord-jd/fuzzy-events
包简介
Perform actions based on fuzzy string matches
README 文档
README
Fuzzy events is a PHP package that allows you to perform actions based on a fuzzy string matches.
Installation
Install using the following Composer command.
composer require jord-jd/fuzzy-events
Usage
See the following usage example.
class Greeting implements FuzzyListenerInterface { public function handle(string $query) { return 'Hello there!'; } }
$listeners = [ Greeting::class => [ 'Hello', 'Hi', 'Hey', 'Greetings', 'Howdy', 'Hello there', 'Hi there', ], ]; $confidenceThreshold = 75; $dispatcher = new FuzzyDispatcher($listeners, $confidenceThreshold); $response = $dispatcher->fire('Greetingz!'); // $response = 'Hello there!' try { $dispatcher->fire('Goodbye!'); } catch (ConfidenceTooLowException $e) { // No matches within specified confidence threshold! } $confidences = $dispatcher->getConfidences('Hi!'); // $confidences = [ // Greeting::class => 80 // ]
统计信息
- 总下载量: 2
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 4
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: LGPL-3.0-only
- 更新时间: 2026-02-14