PHPackages                             roykesserwani/convertapi-php - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. roykesserwani/convertapi-php

ActiveLibrary[API Development](/categories/api)

roykesserwani/convertapi-php
============================

Convert API PHP Client

017.6k—8.2%PHP

Since Jan 2Pushed 3y agoCompare

[ Source](https://github.com/roykesserwani/convertapi-php)[ Packagist](https://packagist.org/packages/roykesserwani/convertapi-php)[ RSS](/packages/roykesserwani-convertapi-php/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

ConvertAPI PHP Client
=====================

[](#convertapi-php-client)

[![PHP version](https://camo.githubusercontent.com/abfa8307aa850a148a9751415c61b15e3e4a3b72d962bb0796d06d846397990b/68747470733a2f2f62616467652e667572792e696f2f70682f636f6e76657274617069253246636f6e766572746170692d7068702e737667)](https://packagist.org/packages/convertapi/convertapi-php)[![Build Status](https://github.com/ConvertAPI/convertapi-php/actions/workflows/main.yml/badge.svg)](https://github.com/ConvertAPI/convertapi-php/actions)

Convert your files with our online file conversion API
------------------------------------------------------

[](#convert-your-files-with-our-online-file-conversion-api)

ConvertAPI helps in converting various file formats. Creating PDF and Images from various sources like Word, Excel, Powerpoint, images, web pages or raw HTML codes. Merge, Encrypt, Split, Repair and Decrypt PDF files and many other file manipulations. You can integrate it into your application in just a few minutes and use it easily.

Requirements
------------

[](#requirements)

PHP 5.4.0 and later.

Installation
------------

[](#installation)

The preferred method is via [composer](https://getcomposer.org). Follow the [installation instructions](https://getcomposer.org/doc/00-intro.md) if you do not already have composer installed.

Once composer is installed, execute the following command in your project root to install this library:

```
composer require convertapi/convertapi-php
```

### Manual Installation

[](#manual-installation)

If you do not wish to use the Composer, you must require ConvertApi autoloader:

```
require_once('/path/to/convertapi-php/src/ConvertApi/autoload.php');
```

Dependencies
------------

[](#dependencies)

Library requires the following extensions in order to work properly:

- [`curl`](https://secure.php.net/manual/en/book.curl.php)
- [`json`](https://secure.php.net/manual/en/book.json.php)

If you use Composer, these dependencies should be handled automatically. If you install manually, you'll want to make sure that these extensions are available.

Usage
-----

[](#usage)

### Configuration

[](#configuration)

You can get your secret at

```
use \ConvertApi\ConvertApi;

ConvertApi::setApiSecret('your-api-secret');
```

### File conversion

[](#file-conversion)

Convert file to PDF example. All supported formats and options can be found [here](https://www.convertapi.com/conversions).

```
$result = ConvertApi::convert('pdf', ['File' => '/path/to/my_file.docx']);

# save to file
$result->getFile()->save('/path/to/save/file.pdf');

# get file contents (without saving the file locally)
$contents = $result->getFile()->getContents();
```

Other result operations:

```
# save all result files to folder
$result->saveFiles('/path/to/save/files');

# get conversion cost
$cost = $result->getConversionCost();
```

#### Convert file url

[](#convert-file-url)

```
$result = ConvertApi::convert('pdf', ['File' => 'https://website/my_file.docx']);
```

#### Specifying from format

[](#specifying-from-format)

```
$result = ConvertApi::convert(
    'pdf',
    ['File' => '/path/to/my_file'],
    'docx'
);
```

#### Additional conversion parameters

[](#additional-conversion-parameters)

ConvertAPI accepts additional conversion parameters depending on selected formats. All conversion parameters and explanations can be found [here](https://www.convertapi.com).

```
$result = ConvertApi::convert(
    'pdf',
    [
        'File' => '/path/to/my_file.docx',
        'PageRange' => '1-10',
        'PdfResolution' => '150',
    ]
);
```

### User information

[](#user-information)

You can always check your remaining seconds amount programmatically by fetching [user information](https://www.convertapi.com/doc/user).

```
$info = ConvertApi::getUser();

echo $info['SecondsLeft'];
```

### More examples

[](#more-examples)

Find more advanced examples in the [examples/](https://github.com/ConvertAPI/convertapi-php/tree/master/examples) folder.

Development
-----------

[](#development)

Testing is done with PHPUnit:

```
CONVERT_API_SECRET=your-api-secret ./bin/phpunit
```

Contributing
------------

[](#contributing)

Bug reports and pull requests are welcome on GitHub at . This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.

License
-------

[](#license)

ConvertAPI PHP Client is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity27

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity23

Early-stage or recently created project

 Bus Factor1

Top contributor holds 65.2% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/e045c9974c30cdd95b1014b371e54fec3e20f5b80145fa1e6ae6a3149b36c630?d=identicon)[yaboyroy](/maintainers/yaboyroy)

---

Top Contributors

[![laurynas-convertapi](https://avatars.githubusercontent.com/u/38224044?v=4)](https://github.com/laurynas-convertapi "laurynas-convertapi (15 commits)")[![JonasJasas](https://avatars.githubusercontent.com/u/16254748?v=4)](https://github.com/JonasJasas "JonasJasas (3 commits)")[![roykesserwani](https://avatars.githubusercontent.com/u/6212457?v=4)](https://github.com/roykesserwani "roykesserwani (3 commits)")[![DanielGSoftware](https://avatars.githubusercontent.com/u/49187378?v=4)](https://github.com/DanielGSoftware "DanielGSoftware (1 commits)")[![kostas-jonauskas](https://avatars.githubusercontent.com/u/62603039?v=4)](https://github.com/kostas-jonauskas "kostas-jonauskas (1 commits)")

### Embed Badge

![Health badge](/badges/roykesserwani-convertapi-php/health.svg)

```
[![Health](https://phpackages.com/badges/roykesserwani-convertapi-php/health.svg)](https://phpackages.com/packages/roykesserwani-convertapi-php)
```

###  Alternatives

[stripe/stripe-php

Stripe PHP Library

4.0k143.3M480](/packages/stripe-stripe-php)[twilio/sdk

A PHP wrapper for Twilio's API

1.6k92.9M272](/packages/twilio-sdk)[facebook/php-business-sdk

PHP SDK for Facebook Business

90821.9M34](/packages/facebook-php-business-sdk)[meilisearch/meilisearch-php

PHP wrapper for the Meilisearch API

74513.7M114](/packages/meilisearch-meilisearch-php)[google/gax

Google API Core for PHP

265103.1M454](/packages/google-gax)[google/common-protos

Google API Common Protos for PHP

173103.7M50](/packages/google-common-protos)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
