承接 knyga/convertapi-php 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

knyga/convertapi-php

Composer 安装命令:

composer require knyga/convertapi-php

包简介

PHP library for the convertapi.com REST API.

README 文档

README

PHP library for the convertapi.com REST API.

ConvertApi is an online file conversion service for creating PDF and Images from various source files, such as Word documents, web pages and raw HTML. converapi-php provides a set of classes for using the ConvertApi service with PHP.

Development of this library is not in any way connected with Baltsoft Software.

Installation via Composer

  • Install Composer to your project root:

    curl -sS https://getcomposer.org/installer | php
  • Add a composer.json file to your project:

    {
        "require": {
            "knyga/convertapi-php": "dev-master"
        }
    }
  • Run the Composer installer:

    php composer.phar install

Using

Using the library is simple:

  1. Include the required concrete class ( include('Text2PDF.php'); )
  2. Instantiate the class ( $text2pdf = new ConvertAPI\Text2Pdf(); )
  3. Either:
  4. Carry out the conversion using filesystem path for output ( $text2pdf->convert('/path/to/intput/file.txt', '/path/to/output/file.pdf'); )
  5. Carry out the conversion using function return for output ( $text2pdf->convert('/path/to/intput/file.txt'); )

The conversion will write the converted document to the given filesystem path and return verious details about the conversion (depending on the response from ConvertApi), or return a binary string representation of the document.

See example/example.php for a working example.

Extending

The library currently supports all the conversions available via convertapi.com.

Addition of new conversions is simply a matter of extending the abstract ConvertAPI class and

a) defining:

  • $_apiUrl - the URL of the ConvertApi endpoint (see http://www.convertapi.com/ for details)
  • $_validInputFormats - an array of document types (extensions) which can be converted

b) completing function __set() to handle additional valid parameters for the conversion being defined.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: GNU
  • 更新时间: 2015-01-03