PHPackages                             devnix/chipmunkphp - 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. devnix/chipmunkphp

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

devnix/chipmunkphp
==================

A PHP FFI binding for Chipmunk physics engine

7.x-dev(5y ago)10[5 issues](https://github.com/devnix/chipmunkphp/issues)MITCPHP &gt;=8.0

Since Jan 26Pushed 5y ago1 watchersCompare

[ Source](https://github.com/devnix/chipmunkphp)[ Packagist](https://packagist.org/packages/devnix/chipmunkphp)[ Docs](https://github.com/devnix/chipmunkphp)[ RSS](/packages/devnix-chipmunkphp/feed)WikiDiscussions 7.x Synced 3d ago

READMEChangelogDependencies (2)Versions (1)Used By (0)

devnix/chipmunkphp
==================

[](#devnixchipmunkphp)

[![Latest Version on Packagist](https://camo.githubusercontent.com/ab744778c1b45bfceffca55de995d83678c13e8b058bd86bfa055168c5d7ff28/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6465766e69782f636869706d756e6b7068702e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/devnix/chipmunkphp)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Build Status](https://camo.githubusercontent.com/0d9ea319315b0dba1bb17518120ef4a8b5678a3424cbb2aeb166cbd775bdc678/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f6465766e69782f636869706d756e6b7068702f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/devnix/chipmunkphp)[![Coverage Status](https://camo.githubusercontent.com/391af100650c8aad643bff5ef507d25c8a45e51ee5e2b9b3bb9edfadea9ab38c/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f6465766e69782f636869706d756e6b7068702e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/devnix/chipmunkphp/code-structure)[![Quality Score](https://camo.githubusercontent.com/9cef959f5093353983b29426726d02c2aae73cb234aff9fae4746459c153e93a/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f6465766e69782f636869706d756e6b7068702e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/devnix/chipmunkphp)[![Total Downloads](https://camo.githubusercontent.com/7091d16b2e653c8bd46a83a6c9d1a56ac2845923fbcda4cb9c19532baf5fa95b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6465766e69782f636869706d756e6b7068702e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/devnix/chipmunkphp)

This project aims to provide a full FFI wrapper around Chipmunk 2D physics engine for PHP. What a time to be alive!

Install
-------

[](#install)

Via Composer

```
$ composer require devnix/chipmunkphp
```

### Dependencies

[](#dependencies)

#### Linux

[](#linux)

You will need to compile and install Chipmunk 7

```
cd /tmp
git clone git@github.com:slembcke/Chipmunk2D.git
cd Chipmunk2D
```

Find the latest 7.x tag and checkout it

```
git tag
```

```
Chipmunk-6.0.0
Chipmunk-6.0.1
Chipmunk-6.0.2
Chipmunk-6.0.3
Chipmunk-6.1
Chipmunk-6.1.1
Chipmunk-6.1.2
Chipmunk-6.1.3
Chipmunk-6.1.4
Chipmunk-6.1.5
Chipmunk-6.2.0
Chipmunk-6.2.1
Chipmunk-6.2.2
Chipmunk-7.0.0
Chipmunk-7.0.1
Chipmunk-7.0.2
Chipmunk-7.0.3
Cocos2D-3.0

```

```
git checkout Chipmunk-7.0.3
```

Then compile, install and clear shared libraries cache.

```
cmake .
make
sudo make install
sudo ldconfig
```

And should be done. Please, give us feedback if you have problems opening an issue.

Change log
----------

[](#change-log)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Hacking
-------

[](#hacking)

The header file for the FFI API must be already processed. You can do it with GCC (I'm just messing with the parameters...):

```
cpp -P -E -D "__attribute__(ARGS)=" ~/tmp/Chipmunk2D/include/chipmunk/chipmunk.h -o include/chipmunk.h  -save-temps
```

Don't forget to hange the `/tmp/Chipmunk2D` path to your needs.

After that, manually remove code of inline functions and let there only the signature. You will also have to manually delete the stdio.h and math.h (I guess) signatures.

I've been messing with [ircmaxell/FFIMe](https://github.com/ircmaxell/FFIMe) but it seems like there is some kind of problem when parsing with [ircmaxell/php-c-parser](https://github.com/ircmaxell/php-c-parser). I would love to find a way to automatically get the working header file automatically to ease the work.

Testing
-------

[](#testing)

```
$ composer test
```

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

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) and [CODE\_OF\_CONDUCT](CODE_OF_CONDUCT.md) for details.

Security
--------

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Pablo Largo Mohedano](https://github.com/devnix), author of this package.
- Victor Blomqvist, I have stolen documentation and ideas from [Pymunk](https://github.com/viblo/pymunk).
- Scott Lembcke and Howling Moon Software, makers of [Chipmnunk](https://github.com/slembcke/Chipmunk2D), parts of C header files are in this project.
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

14

—

LowBetter than 2% of packages

Maintenance0

Infrequent updates — may be unmaintained

Popularity2

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity42

Maturing project, gaining track record

 Bus Factor1

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

Unknown

Total

1

Last Release

1935d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/462de3bc6b5b394cc968eb74fc519cb923d18903f79cad6dc0397f9607b41f36?d=identicon)[DevNIX](/maintainers/DevNIX)

---

Top Contributors

[![devnix](https://avatars.githubusercontent.com/u/1777519?v=4)](https://github.com/devnix "devnix (2 commits)")

---

Tags

phpgameengineffiphysics2ddevnixchipmunkphpchipmunk

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/devnix-chipmunkphp/health.svg)

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

###  Alternatives

[irfa/php-gatcha

Simple Items Gatcha with PHP

362.4k](/packages/irfa-php-gatcha)

PHPackages © 2026

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