PHP-SDL extension source code
Switch branches/tags
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
examples feat: Support for SDL_RenderCopyEx (#25) Dec 2, 2018
tests Remove userdata from SDL_Window struct as that can be implemented bet… Sep 8, 2018
.gitattributes attr Dec 11, 2013
.gitignore Update extension summary and description Sep 22, 2018
.travis.yml Instruct travis to return to main directory after installing sdl library Sep 8, 2018
CREDITS SDL_SetError(), SDL_GetError(), SDL_ClearError Dec 6, 2013
EXPERIMENTAL New extension Dec 2, 2013
LICENSE New extension Dec 2, 2013
README.md Update README to point to the right build badge in travis ci Sep 8, 2018
blendmode.c Use ZEND_STRL instead of sizeof Aug 30, 2018
blendmode.h Use ZEND_STRL instead of sizeof Aug 30, 2018
check-files-are-in-package-xml.sh Prepare version 2.1.0-dev for release Sep 22, 2018
config.m4 Make extension great again (PHP7 compatible as well) Aug 25, 2018
cpuinfo.c Use ZEND_STRL instead of sizeof Aug 30, 2018
cpuinfo.h Use ZEND_STRL instead of sizeof Aug 30, 2018
error.c Use ZEND_STRL instead of sizeof Aug 30, 2018
error.h Use ZEND_STRL instead of sizeof Aug 30, 2018
event.c Remove unused code Sep 1, 2018
event.h Use ZEND_STRL instead of sizeof Aug 30, 2018
filesystem.c Update copyright and PHP version shown in comment headers Aug 27, 2018
filesystem.h Update copyright and PHP version shown in comment headers Aug 27, 2018
glcontext.c Remove unused code Sep 1, 2018
glcontext.h Remove unused code Sep 1, 2018
keyboard.c Skip failing unit test for now (they need to be redone anyway) Aug 30, 2018
keyboard.h Skip failing unit test for now (they need to be redone anyway) Aug 30, 2018
messagebox.c Remove code that produces error if it's not part of the core API Sep 25, 2018
messagebox.h Remove unused code Sep 1, 2018
mouse.c Update SDL Cursor example to use HAND cursor Sep 8, 2018
mouse.h Skip failing unit test for now (they need to be redone anyway) Aug 30, 2018
mutex.c Skip failing unit test for now (they need to be redone anyway) Aug 30, 2018
mutex.h Skip failing unit test for now (they need to be redone anyway) Aug 30, 2018
package.xml Update extension summary and description Sep 22, 2018
php_sdl.c feat: Support for SDL_RenderCopyEx (#25) Dec 2, 2018
php_sdl.h Update extension summary and description Sep 22, 2018
pixels.c Remove code that produces error if it's not part of the core API Sep 25, 2018
pixels.h Update copyright and PHP version shown in comment headers Aug 27, 2018
platform.c Skip failing unit test for now (they need to be redone anyway) Aug 30, 2018
platform.h Skip failing unit test for now (they need to be redone anyway) Aug 30, 2018
power.c Skip failing unit test for now (they need to be redone anyway) Aug 30, 2018
power.h Skip failing unit test for now (they need to be redone anyway) Aug 30, 2018
rect.c Remove code that produces error if it's not part of the core API Sep 25, 2018
rect.h Skip failing unit test for now (they need to be redone anyway) Aug 30, 2018
render.c feat: Support for SDL_RenderCopyEx (#25) Dec 2, 2018
render.h feat: Support for SDL_RenderCopyEx (#25) Dec 2, 2018
rwops.c Remove code that produces error if it's not part of the core API Sep 25, 2018
rwops.h Skip failing unit test for now (they need to be redone anyway) Aug 30, 2018
sdl.c Remove userdata from SDL_Window struct as that can be implemented bet… Sep 8, 2018
sdl.h Update copyright and PHP version shown in comment headers Aug 27, 2018
shape.c Remove code that produces error if it's not part of the core API Sep 25, 2018
shape.h Remove unused code Sep 1, 2018
surface.c Restore read_property in surface object Sep 25, 2018
surface.h Update copyright and PHP version shown in comment headers Aug 27, 2018
timer.c Update copyright and PHP version shown in comment headers Aug 27, 2018
timer.h Update copyright and PHP version shown in comment headers Aug 27, 2018
version.c Update copyright and PHP version shown in comment headers Aug 27, 2018
version.h Update copyright and PHP version shown in comment headers Aug 27, 2018
video.c Use ZEND_STRL instead of sizeof Aug 30, 2018
video.h Fix some of the failing unit tests (more to fix) Aug 29, 2018
window.c Fix issue with GetWindowSize/GetWindowPosition functions (not updatin… Nov 18, 2018
window.h Merge branch 'master' of github.com:Ponup/phpsdl Nov 18, 2018

README.md

Build Status

PHP-SDL

Installation

Requirements

  • C compiler
  • Automake tools
  • PHP devel
  • libSDL2 devel libraries and headers

Via PECL (recommended)

pecl install sdl-beta

Manual

Download the source code and within the main directory run these commands:

$ phpize --clean
$ phpize
$ ./configure --with-sdl (or --with-sdl=<PATH>)
$ make
$ make test
$ sudo make install

Then add

extension=sdl.so

to your php.ini file.

Installing on Windows

We are working on the Windows build. Stay tuned.

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.

Example

Standard SDL2 API is available in procedural style:

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

And is also available in object oriented style:

    $w = new SDL_Window( "Foo window", 100, 50, 350, 300, SDL_Window::SHOWN|SDL_Window::RESIZABLE);
    $w->SetTitle("Some new title");
    unset($w); // will destroy the window

BUILDING ON UNIX etc.

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

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

BUILDING ON WINDOWS

Not supported yet.

Support / Feedback / Bugs / Feature Requests

Please submit anything that needs our attention to issues section on Github. We are commited to attend any request in a short timespan if it's a sensible matter.