Make games in PHP! Or create real-time visualizations! Or design your own GUI library!
PHP-GLFW brings 2D and 3D rendering capabilities to PHP.
The obvious one, this extension contains almost full support for GLFW, which provides a simple API for creating windows, contexts, and surfaces, as well as for handling input and system events.
PHP-GFLW works on Window, MacOS and Linux. We also support standalone & portable binaries for MacOS and Windows.
Just want to get something onto the screen quickly without having to deal with shaders, vertices, and lots of boilerplate? PHP-GLFW supports a Vector Graphics API for drawing simple graphics with minimal effort.
Full native support for OpenGL (4.1+ core), bringing GPU-accelerated rendering to PHP. We currently support approximately 90% of the full standard.
PHP-GLFW comes with a built-in mathematics library, written in C and optimized for graphical applications. It includes common structs like
Mat4, etc., and many operations you usually find in graphical applications like
Need to load an image as a texture or a 3D model? We don't leave you hanging; PHP-GLFW contains many utilities for your GameDev or application needs.
Hey that rhymes!
Step into 3D programming with PHP-GLFW, bridging PHP with the amazing power and simplicity of OpenGL.
We try hard to keep the API as close as possible to its
C counterpart, which has a few benefits.
We do not predetermine how the rendering pipeline works, thus providing you with full and granular control over the rendering process.
While PHP-GLFW shines in 3D rendering, it's equally adept in flatland aka in 2D space. We made FlappyPHPant, our PHP-powered tribute to Flappy Bird.Check it out
When doing anything with rendering, you unfortunately can't avoid maths.
But don't worry, we've got you covered!
PHP-GLFW includes a simple and fast math library, written in C, to minimize runtime overhead as much as possible. There will still be a significant overhead, though...
.obj files per drag and drop into a 3D scene.
PHP has never been made with GameDev or real-time applications in mind. Thus, there are many basic things missing you usally need when developing such applications.
PHP-GLFW tries to bridge this gap by providing various utilities:
PHP arrays essentially are hashmaps, which are great but not so great for storing millions of floats. PHP-GLFW offers buffer objects for numeric data types, stored in a contiguous memory block, yet these can still be accessed like a PHP array.
We include loaders for images (
) and 3D models (
Install in 5 minutes
If you haven't installed PHP-GLFW yet, follow the installation guide for your platform.
PHP OpenGL Tutorial
Everything ready to get started? Jump right into the first chapter of the tutorial.
Want to directly dig into example code? Check out the examples folder.