amaccis / php-dict
PHP DICT 客户端
0.1.0
2020-11-19 22:21 UTC
Requires
- php: ^7.4
- ext-curl: *
Requires (Dev)
- phpstan/phpstan: ^0.12.11
- phpunit/phpunit: ^8.5
This package is auto-updated.
Last update: 2024-09-11 04:07:10 UTC
README
DICT 协议
根据 RFC 2229,字典服务器协议(DICT)是一种基于 TCP 事务的查询/响应协议,允许客户端从一组自然语言字典数据库中访问词典定义。更多详情请见 dict.org。
安装
php-dict 可在 Packagist 上找到,您可以使用 Composer 进行安装。
composer require amaccis/php-stemmer
用法
<?php use Amaccis\Dict\Client; use Amaccis\Dict\Query\CommandInterface; $client = new Client(); $parameters = [ 'command' => CommandInterface::COMMAND_DEFINE, 'word' => 'hacker', 'database' => 'jargon' ]; $response = $client->query('dict.org', $parameters); var_dump($response); /* array(6) { [0] => class Amaccis\Dict\Response\Response#358 (2) { private $code => string(3) "220" private $text => string(84) "dict dictd 1.12.1/rf on Linux 4.19.0-10-amd64 <auth.mime> <534.2367.1605732508@dict>" } [1] => class Amaccis\Dict\Response\Response#357 (2) { private $code => string(3) "250" private $text => string(2) "ok" } [2] => class Amaccis\Dict\Response\Response#356 (2) { private $code => string(3) "150" private $text => string(23) "1 definitions retrieved" } [3] => class Amaccis\Dict\Response\Response#355 (2) { private $code => string(3) "151" private $text => string(2516) ""hacker" jargon "The Jargon File (version 4.4.7, 29 Dec 2003)" hacker n. [originally, someone who makes furniture with an axe] 1. A person who enjoys exploring the details of programmable systems and how to stretch their capabilities, as opposed to most users, who prefer to learn only the minimum necessary. RFC1392, the Internet Users' Glossary, usefully amplifies this as: A person who delights in having an intimate understanding of the internal workings of a system, com"... } [4] => class Amaccis\Dict\Response\Response#354 (2) { private $code => string(3) "250" private $text => string(41) "ok [d/m/c = 1/0/10; 0.000r 0.000u 0.000s]" } [5] => class Amaccis\Dict\Response\Response#353 (2) { private $code => string(3) "221" private $text => string(41) "bye [d/m/c = 0/0/0; 0.000r 0.000u 0.000s]" } } */
许可证
所有文件均为 MIT © Andrea Maccis