PHPackages                             convertapi/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. convertapi/convertapi-php

ActiveLibrary[API Development](/categories/api)

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

Convert API PHP Client

v3.0.0(1y ago)523.9M—0.3%20[1 issues](https://github.com/ConvertAPI/convertapi-library-php/issues)MITPHPPHP &gt;=8.0CI passing

Since Jun 25Pushed 11mo ago3 watchersCompare

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

READMEChangelog (6)Dependencies (1)Versions (18)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 8.1.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/lib/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 API credentials at

```
use \ConvertApi\ConvertApi;

ConvertApi::setApiCredentials('your-api-secret-or-token');
```

### 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/conversions).

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

### User information

[](#user-information)

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

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

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

### Alternative domain

[](#alternative-domain)

Use `setApiBase` method to set alternative service domain. Dedicated to the region [domain list](https://www.convertapi.com/doc/servers-location).

```
ConvertApi::setApiBase('https://eu-v2.convertapi.com/');
```

### 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

54

—

FairBetter than 97% of packages

Maintenance43

Moderate activity, may be stable

Popularity57

Moderate usage in the ecosystem

Community20

Small or concentrated contributor base

Maturity76

Established project with proven stability

 Bus Factor1

Top contributor holds 62.5% 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.

###  Release Activity

Cadence

Every ~142 days

Recently: every ~181 days

Total

17

Last Release

612d ago

Major Versions

v1.7.0 → v2.0.02024-02-16

v2.0.1 → v3.0.02024-09-14

PHP version history (2 changes)v1.0.0PHP &gt;=5.4.0

v2.0.0PHP &gt;=8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/ae5a84844b7325113d24558005f6f685c627201d1bbb61d74d8f35dddbee49e6?d=identicon)[laurynas-baltsoft](/maintainers/laurynas-baltsoft)

---

Top Contributors

[![laurynas-convertapi](https://avatars.githubusercontent.com/u/38224044?v=4)](https://github.com/laurynas-convertapi "laurynas-convertapi (25 commits)")[![JonasJasas](https://avatars.githubusercontent.com/u/16254748?v=4)](https://github.com/JonasJasas "JonasJasas (10 commits)")[![apple-yagi](https://avatars.githubusercontent.com/u/57742720?v=4)](https://github.com/apple-yagi "apple-yagi (1 commits)")[![mijohen](https://avatars.githubusercontent.com/u/5109410?v=4)](https://github.com/mijohen "mijohen (1 commits)")[![paulius-petkus](https://avatars.githubusercontent.com/u/162338583?v=4)](https://github.com/paulius-petkus "paulius-petkus (1 commits)")[![kostas-jonauskas](https://avatars.githubusercontent.com/u/62603039?v=4)](https://github.com/kostas-jonauskas "kostas-jonauskas (1 commits)")[![DanielGSoftware](https://avatars.githubusercontent.com/u/49187378?v=4)](https://github.com/DanielGSoftware "DanielGSoftware (1 commits)")

---

Tags

apiclientconvertconversion

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[pdfcrowd/pdfcrowd

A client library for the Pdfcrowd API. It lets you convert between HTML, PDF and various image formats

631.1M1](/packages/pdfcrowd-pdfcrowd)[deepseek-php/deepseek-php-client

deepseek PHP client is a robust and community-driven PHP client library for seamless integration with the Deepseek API, offering efficient access to advanced AI and data processing capabilities.

47073.9k5](/packages/deepseek-php-deepseek-php-client)[skeeks/yii2-google-api

Component for work with google api based on google/apiclient

1243.1k1](/packages/skeeks-yii2-google-api)

PHPackages © 2026

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