定制 jaybizzle/doc-to-text 二次开发

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

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

jaybizzle/doc-to-text

Composer 安装命令:

composer require jaybizzle/doc-to-text

包简介

Extract text from a Word Doc

README 文档

README

Latest Version on Packagist Software License Build Status Quality Score Total Downloads

This package provides a class to extract text from a Word Doc.

<?php

use Jaybizzle\DocToText\Doc;

echo Doc::getText('book.doc'); // returns the text from the doc

Requirements

Behind the scenes this package leverages antiword. You can verify if the binary is installed on your system by issuing this command:

which antiword

If it is installed it will return the path to the binary.

To install the binary you can use this command on Ubuntu or Debian:

apt-get install antiword

Installation

You can install the package via composer:

composer require jaybizzle/doc-to-text

Usage

Extracting text from a Doc is easy.

$text = (new Doc())
    ->setDoc('book.doc')
    ->text();

Or easier:

echo Doc::getText('book.doc');

By default the package will assume that the antiword command is located at /usr/bin/antiword. If it is located elsewhere pass its binary path to the constructor

$text = (new Doc('/custom/path/to/antiword'))
    ->setDoc('book.doc')
    ->text();

or as the second parameter to the getText static method:

echo Doc::getText('book.doc', '/custom/path/to/antiword');

Sometimes you may want to use antiword options. To do so you can set them up using the setOptions method.

$text = (new Doc())
    ->setDoc('table.doc')
    ->setOptions(['f', 'w 80'])
    ->text()
;

or as the third parameter to the getText static method:

echo Doc::getText('book.doc', null, ['f', 'w 80']);

Change log

Please see CHANGELOG for more information about what has changed recently.

Testing

 composer test

Security

If you discover any security related issues, please email mbeech@mark-beech.co.uk instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.

统计信息

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

GitHub 信息

  • Stars: 5
  • Watchers: 1
  • Forks: 4
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-12-05

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固