PHPackages                             marcelbolten/php-cairo - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. marcelbolten/php-cairo

ActivePhp-ext[Utility &amp; Helpers](/categories/utility)

marcelbolten/php-cairo
======================

Cairo graphics library for PHP

2.0.0alpha2(3mo ago)21.1kMITPHPPHP &gt;=8.1CI passing

Since Sep 28Pushed 3mo agoCompare

[ Source](https://github.com/MarcelBolten/php-cairo)[ Packagist](https://packagist.org/packages/marcelbolten/php-cairo)[ Docs](https://github.com/MarcelBolten/php-cairo)[ RSS](/packages/marcelbolten-php-cairo/feed)WikiDiscussions overhaul Synced 1mo ago

READMEChangelog (5)DependenciesVersions (5)Used By (0)

Cairo for PHP 8.1+
==================

[](#cairo-for-php-81)

[Cairo](https://www.cairographics.org/) is a 2D graphics library with support for multiple output devices. Output targets include the X Window System (via both Xlib and XCB), Quartz, Win32, image buffers, PostScript, PDF, and SVG files.

This extension provides access to Cairo functionality in PHP 8.1+ in the Cairo namespace.

[![Build and Test](https://github.com/MarcelBolten/php-cairo/actions/workflows/ci.yml/badge.svg?branch=overhaul)](https://github.com/MarcelBolten/php-cairo/actions/workflows/ci.yml)

Requirements
============

[](#requirements)

- PHP 8.1.0+
- Cairo 1.12.0+

Additional features are supported up to Cairo version 1.18.4.

Features are enabled at compile time based on the library version they are compiled against.

Documentation and information about the underlying library can be found at [cairographics.org](http://cairographics.org/manual/).

Installation
============

[](#installation)

There are plans to make this available via [PIE (PHP Installer for Extensions)](https://github.com/php/pie)

Until then, please compile and install the cairo extensions and enable it in your php.ini file.

```
extension=cairo.so

```

Compile
=======

[](#compile)

This extension can be compiled and tested using phpize.

The cairo extension also requires cairo development files. You can build the package manually or use your system's package manager. For example on ubuntu use:

```
apt-get install libcairo2-dev libfreetype6-dev fontconfig libjpeg-dev

```

Then you can use phpize to install the extension against your current PHP install:

```
phpize
./configure
make && make test && make install

```

If you want to use a non-standard location for your PHP use:

```
/path/to/phpize
./configure --with-php-config=/path/to/php-config
make && make test && make install

```

`make install` copies `cairo.so` to the right location, but you still need to enable the module in your php.ini file.

Codec overage reports
=====================

[](#codec-overage-reports)

A [coverage report](https://marcelbolten.github.io/php-cairo/src/) is uploaded to gh-pages during every [Build and Test](https://github.com/MarcelBolten/php-cairo/actions/workflows/ci.yml) workflow.

Requirements: lcov, gzip.

To obtain a code coverage report the extension must be compiled with additional flags:

```
phpize
CAIRO_COVERAGE=yes ./configure
make && make install
coverage.sh

```

This will run all tests and create an html report.

Examples
========

[](#examples)

The examples directory holds samples of all currently working utilities for the extension.

Community
=========

[](#community)

You can send comments, patches, questions [here on github](https://github.com/marcelbolten/php-cairo/issues)

Authors
=======

[](#authors)

Elizabeth M Smith | Swen Zanon | Marcel Bolten | Bernhard R. Fischer (JPEG-integration)

License
=======

[](#license)

PHP extension binding code released under the [MIT license](http://opensource.org/licenses/MIT)See [LICENSE](LICENSE)

The Cairo Graphics library is released under the [LGPL](https://www.gnu.org/licenses/old-licenses/lgpl-2.1.en.html)

Documentation
=============

[](#documentation)

What little documentation we currently have is in code comments and the docs directory.

We'd like to use some kind of markdown or rst format for docs, a decision isn't final yet.

###  Health Score

38

—

LowBetter than 85% of packages

Maintenance81

Actively maintained with recent releases

Popularity17

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity33

Early-stage or recently created project

 Bus Factor1

Top contributor holds 55.9% 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 ~3 days

Total

3

Last Release

100d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/454418cdca1dd5f4f92bed36c6b829a647760387e132e84fb6fc9b9b688198f9?d=identicon)[marcelbolten](/maintainers/marcelbolten)

---

Top Contributors

[![MarcelBolten](https://avatars.githubusercontent.com/u/65481677?v=4)](https://github.com/MarcelBolten "MarcelBolten (465 commits)")[![swen100](https://avatars.githubusercontent.com/u/1837968?v=4)](https://github.com/swen100 "swen100 (128 commits)")[![auroraeosrose](https://avatars.githubusercontent.com/u/282573?v=4)](https://github.com/auroraeosrose "auroraeosrose (98 commits)")[![mgdm](https://avatars.githubusercontent.com/u/71893?v=4)](https://github.com/mgdm "mgdm (73 commits)")[![openaki](https://avatars.githubusercontent.com/u/1911812?v=4)](https://github.com/openaki "openaki (26 commits)")[![Jan-E](https://avatars.githubusercontent.com/u/1757825?v=4)](https://github.com/Jan-E "Jan-E (18 commits)")[![mahcuz](https://avatars.githubusercontent.com/u/414241?v=4)](https://github.com/mahcuz "mahcuz (11 commits)")[![felipensp](https://avatars.githubusercontent.com/u/773947?v=4)](https://github.com/felipensp "felipensp (3 commits)")[![hholzgra](https://avatars.githubusercontent.com/u/451772?v=4)](https://github.com/hholzgra "hholzgra (3 commits)")[![weltling](https://avatars.githubusercontent.com/u/22016?v=4)](https://github.com/weltling "weltling (2 commits)")[![mhertsch](https://avatars.githubusercontent.com/u/8458597?v=4)](https://github.com/mhertsch "mhertsch (1 commits)")[![geoglis](https://avatars.githubusercontent.com/u/15996736?v=4)](https://github.com/geoglis "geoglis (1 commits)")[![remicollet](https://avatars.githubusercontent.com/u/270445?v=4)](https://github.com/remicollet "remicollet (1 commits)")[![derickr](https://avatars.githubusercontent.com/u/208074?v=4)](https://github.com/derickr "derickr (1 commits)")[![johannes](https://avatars.githubusercontent.com/u/44364?v=4)](https://github.com/johannes "johannes (1 commits)")

---

Tags

drawinggraphicsphp-extensioncairo2d

### Embed Badge

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

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

###  Alternatives

[imagine/imagine

Image processing for PHP

4.5k72.4M341](/packages/imagine-imagine)[rubix/tensor

A library and extension that provides objects for scientific computing in PHP.

2751.4M5](/packages/rubix-tensor)[rokka/imagine-vips

libvips adapter for imagine

43564.1k5](/packages/rokka-imagine-vips)[pixelandtonic/imagine

Image processing for PHP

133.4M3](/packages/pixelandtonic-imagine)[serafim/ffi-sdl

SDL FFI bindings for the PHP language

314.6k3](/packages/serafim-ffi-sdl)

PHPackages © 2026

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