php-sdl fork used by the JumPHP engine builds (pinned commit 89855c8)
  • C 90.6%
  • PHP 8.7%
  • M4 0.4%
  • JavaScript 0.1%
  • Dockerfile 0.1%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Santiago Lizardo 96a6c7f9a9
Some checks failed
Build and test / main (push) Failing after 2s
Fix version test
2023-08-06 22:14:12 +01:00
.github/workflows Show badge in readme 2022-01-23 18:48:39 +00:00
examples Add some functions (#69) 2022-12-27 23:25:54 +00:00
src Use new parameter parsing method 2022-12-31 15:35:11 +00:00
tests Fix version test 2023-08-06 22:14:12 +01:00
.dockerignore Create docker file to use with travis 2020-06-20 21:37:22 +01:00
.gitattributes attr 2013-12-11 18:14:46 +01:00
.gitignore Add SDL functions binding of float rect and float point render functions (#57) 2022-03-07 19:26:35 +00:00
check-files-are-in-package-xml.sh Prepare version 2.1.0-dev for release 2018-09-22 12:20:21 +01:00
config.m4 deprecate SDL_GetRevisionNumber (#65) 2022-03-23 18:13:44 +00:00
config.w32 Config file for Windows (#53) 2021-10-12 20:14:31 +01:00
CREDITS Add Benoit to credits 2022-03-23 22:08:47 +00:00
docker-entrypoint.sh Create docker file to use with travis 2020-06-20 21:37:22 +01:00
Dockerfile Use github actions 2022-01-19 23:04:07 +00:00
input-handling-example.gif Add gif example and link to readme 2020-06-21 13:02:13 +01:00
LICENSE Update license 2022-01-18 20:26:50 +00:00
package.xml Fix issue on SDL_GetKeyboardState 2022-07-22 15:14:30 +01:00
README.md Update README.md 2022-07-23 11:26:03 +01:00

Build and test

PHP-SDL

SDL (Simple DirectMedia Layer) bindings for the PHP language. The extension allows you to create multimedia desktop applications with windows, input handling, events, and more.

Installation

Requirements

  • C compiler
  • Automake tools
  • PHP8.1 devel
  • libSDL2 devel libraries and headers
  • UN*X OS (eg Linux, Macos)

Via PECL

pecl install sdl-beta

Then add

extension=sdl.so

to your php.ini file.

If you have no idea about your ini file position you can run php -i | grep ini and see the list of you ini files.

Documentation

The SDL extension mimics in almost every single aspect to the official C library, so until we write our own documentation, refer to the C counterpart.

Examples

Standard SDL2 API is available in procedural style:

$window = SDL_CreateWindow( "Foo window", 500, 50, 350, 300, SDL_WINDOW_SHOWN+SDL_WINDOW_RESIZABLE);
SDL_SetWindowTitle($window, "Some new title");
SDL_DestroyWindow($window);

Complete examples can be found in the examples folder.

Projects using the extension

Building

To compile your new extension, you will have to execute the following steps:

phpize
./configure [--with--sdl] 
make
make test
sudo make install