定制 nekulin/php-apache-tika 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

nekulin/php-apache-tika

Composer 安装命令:

composer require nekulin/php-apache-tika

包简介

Apache Tika bindings for PHP: extracts text from documents and images (with OCR), metadata and more...

README 文档

README

This tool provides Apache Tika bindings for PHP, allowing to extract text and metadata from documents, images and other formats.

Two modes are supported:

Server mode is recommended because is 5 times faster, but some shared hosts don't allow run processes in background.

Features

  • Simple class interface to Apache Tika features:
    • Text and HTML extraction
    • Metadata extraction
    • OCR recognition
  • Standarized metadata for documents
  • Support for local and remote resources
  • No heavyweight library dependencies

Requirements

  • PHP 5.4 or greater
  • Apache Tika 1.7 or greater
  • Oracle Java or OpenJDK
    • Java 6 for Tika up to 1.9
    • Java 7 for Tika 1.10 or greater
  • Tesseract (optional for OCR recognition)

Installation

Install using composer:

composer require vaites/php-apache-tika

If you want to use OCR you must install Tesseract:

  • Fedora/CentOS: sudo yum install tesseract (use dnf instead of yum on Fedora 22 or greater)
  • Debian/Ubuntu: sudo apt-get install tesseract-ocr
  • Mac OS X: brew install tesseract (using Homebrew)

Usage

Start Apache Tika server with caution:

java -jar tika-server-1.10.jar

Instantiate the class:

$client = \Vaites\ApacheTika\Client::make('localhost', 9998);           // server mode (default)
$client = \Vaites\ApacheTika\Client::make('/path/to/tika-app.jar');     // app mode 

Use the class to extract text from documents:

$language = $client->getLanguage('/path/to/your/document');
$metadata = $client->getMetadata('/path/to/your/document');

$html = $client->getHTML('/path/to/your/document');
$text = $client->getText('/path/to/your/document');

Or use to extract text from images:

$client = \Vaites\ApacheTika\Client::make($host, $port);
$metadata = $client->getMetadata('/path/to/your/image');

$text = $client->getText('/path/to/your/image');

Integrations

统计信息

  • 总下载量: 22
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 22
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-01-26

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固