purencool / search
PHP 搜索
v1.1.2
2020-08-31 20:36 UTC
Requires
- php: *
Requires (Dev)
- phpunit/phpunit: 9.*
- tacnoman/dephpugger: dev-master
This package is auto-updated.
Last update: 2024-09-29 05:42:49 UTC
README
功能
- PSR-4 自动加载兼容结构
- 使用 PHPUnit 进行单元测试
- 全面的指南和教程
- 易于在任何框架或纯 PHP 文件中使用
安装
依赖
- Composer
- PHP
composer require purencool/search
如何使用库
安装后,最简单的方式使用此库如下
$obj = new Purencool\Search\Search([我选择的数组]);
$results= $obj->getSearchResults(['search_request' => '我正在搜索的字符串']);
开发
依赖
- Composer
- PHP
- PHPUnit
- Xdebug
- Dephpugger
安装
- 克隆目录
git clone https://github.com/purencool/search.git - 安装 vendor 目录
composer install
调试
- 安装 xdebug
- 在库的根目录下,从终端运行
./vendor/bin/dephpugger server应该会看到服务器启动 - 在 index.php 文件中取消注释
xdebug_break();函数 - 在另一个终端中导航到库的根目录,并运行
./vendor/bin/dephpugger debug应该开始监听 - 在浏览器中转到 localhost:8888,页面将加载但无法解析。
- 回到你输入
./vendor/bin/dephpugger debug命令的终端,你应该看到Connected to XDebug server! - 要导航到调试器,请转到 dephpugger 命令
查看工作示例
./vendor/bin/dephpugger server 或 php -S localhost:8000 然后在浏览器中导航。
单元测试
./vendor/bin/phpunit 运行所有 PHPUnit 测试 ./vendor/bin/phpunit --filter <className> 运行一组测试
故障排除
如果测试不起作用,请运行以下命令。
composer dump-autoload
贡献者
感谢 sielver 解决命名空间问题