bangpound/tika-rest-client
Composer 安装命令:
composer require bangpound/tika-rest-client
包简介
Web services client for Apache Tika
README 文档
README
This PHP client interacts with the Tika REST Server for extracting content and metadata from a [wide variety of document file types][types]. There are [alternative PHP libraries][alternatives] that use the Tika command line client, but instantiating the JVM for each operation is slow and costly.
This client is built on Guzzle.
"see "Using Tika as a command line utility"" [types]: http://tika.apache.org/1.4/formats.html [alternatives]: https://packagist.org/search/?q=tika
Project Setup
This project is installed with composer.
In the shell, you can run this command:
composer require bangpound/tika-rest-client
Or you can edit your composer.json file to include this requirement:
{
"require": {
"bangpound/tika-rest-client": "^1.0"
}
}
Usage
<?php $client = new Bangpound\Tika\Client('http://localhost:9998'); $response = $client->tika(array( 'file' => 'TestPDF.pdf', )); // Metadata varies by file and file type, so refer to the Apache Tika docs for details. $all_metadata = $response->metadata; // If you know the metadata element you want to retrieve, specify it as the argument // to the response's metadata method. $author = $response->metadata('author'); // Extracted content can be retrieved as a SimpleXMLElement or a string of XML. $content_xml = $response->getBody(); $page_2 = $content_xml->children()->div[1]; $content_text = $response->getBody(true);
Testing
The Tika REST Client has an incomplete suite of tests. Run them using phpunit after installing the dev dependencies.
composer install phpunit
License
This code is released under the MIT license.
bangpound/tika-rest-client 适用场景与选型建议
bangpound/tika-rest-client 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 4.66k 次下载、GitHub Stars 达 2, 最近一次更新时间为 2013 年 09 月 16 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 bangpound/tika-rest-client 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 bangpound/tika-rest-client 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 4.66k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2013-09-16