Skip to content

Quick guide to increase Raylib FFI's coverage

Níckolas Daniel da Silva edited this page Jun 30, 2021 · 6 revisions

The quickest thing you can do to increase Raylib FFI's coverage is to simply port a new example from Raylib 3.7 to PHP.

You can check Raylib 3.7 C examples here: https://github.com/raysan5/raylib/tree/3.7.0/examples/.

Port checklist

  • Create a .php with same basename and path structure as Raylib's (e.g. examples/core/core_2d_camera.c becomes examples/core/core_2d_camera.php
  • Translate all C calls to PHP calls
  • Update README.md, section Examples, to tick off your newly added example
  • Update README.md, section FFI Proxy, to tick off all new functions you've added
  • Add unit tests that guarantees parameter proxying is correct
  • Run composer checks to make sure your fresh code passes all tests and analysis
  • Open a pull request and mark @nawarian as your reviewer

Testing

It is highly recommended that you run your new example file on your machine, but for different reasons this may require you to compile PHP manually (because of edge bugs solved only next release or something).

If you can't compile php by yourself, that's still ok but mind that communication on Pull Requests will last longer.

There is a docker-compose.yml defining useful services for your testing. You won't be able to run any windows with it, but at least unit tests will run through.

Here's how you can test with different PHP versions using docker-compose:

$ docker-compose run php-7.4 composer.phar checks
$ docker-compose run php-8.0 composer.phar checks
$ docker-compose run php-8.1 composer.phar checks

(The above snippet considers you've downloaded composer.phar to your raylib's root dir).

Clone this wiki locally