Download the PHP package microscrap/glfw without Composer
On this page you can find all versions of the php package microscrap/glfw. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download microscrap/glfw
More information about microscrap/glfw
Files in microscrap/glfw
Package glfw
Short Description LibGLFW Bindings for The PHP GLFW Extension
License MIT
Homepage https://scrapyard-io.projectsaturnstudios.com/ecosystem/microscrap/glfw/0.7.x/overview
Informations about the package glfw
microscrap/glfw — LibGLFW bindings for PHP
Docs (production): ScrapyardIO · microscrap/glfw 0.7.x
PHP library that wraps the glfw extension with global helpers, enums, and data objects. Every helper delegates to a static wrapper class under Microscrap\Bindings\GLFW.
The package covers the entire extension surface (124 GLFWAPI methods + a small OpenGL convenience set across 8 extension classes): init, error, windows, monitors, input/joysticks/gamepads, context, Vulkan, and minimal GL clear/viewport helpers for visual proofs.
Ecosystem docs: 0.7.x. For OpenGL draw APIs prefer microscrap/open-gl; tubes OpenGL deferred buffers live in microscrap/ogx.
Highlights
- Two calling styles — exact C names (
glfwCreateWindow(...)) or static wrapper classes (Window::createWindow(...)) - Opaque GLFW handles wrapped in typed
final readonlydata objects (GlfwWindow,GlfwMonitor,GlfwCursor) - Enum layer transcribed from glfw3.h — keys, hints, actions, joysticks/gamepads, context/client API tokens, plus a few GL enums used by the convenience layer
- C-style error handling: no exceptions in
src/; details viaglfwGetError() - Coverage drift guard: a Pest test reflects the extension and fails if any extension method lacks a wrapper method or helper function
Requirements
- PHP 8.3+
- ext-glfw ^0.5.0 — install from php-io-extensions/glfw
Installation
Confirm ext-glfw is loaded:
Composer autoloads all helper files in src/Helpers/, registering the global glfw* / gl* functions when the package is installed. Helpers are only defined if the name is not already taken (function_exists guard).
The two calling styles
C-ish — global functions with exact GLFW C names:
OO-ish — static wrapper classes, same behavior:
Helpers never touch the extension directly; they delegate one-to-one to the wrapper classes, which are the only layer calling Glfw\GLFW\*. Both styles accept and return the same data objects, and every flag/enum parameter takes EnumType|int.
Name transforms
- Wrapper methods drop the
glfwprefix:glfwCreateWindow→Window::createWindow(). - The
GLclass drops theglprefix:glClearColor→GL::clearColor(). - Helpers use the exact C / extension method name (
glfwCreateWindow(),glClear()).
macOS note: data objects are named
GlfwWindow/GlfwMonitor/GlfwCursor(notGLFWwindow) so they do not collide with the extension classesGLFWWindow/GLFWMonitoron case-insensitive filesystems.
Wrapper classes
| Class | Wraps | Methods | Subsystem |
|---|---|---|---|
Init |
Glfw\GLFW\GLFW |
10 | init/terminate, version, platform, error callback |
Error |
GLFWError |
1 | glfwGetError |
Window |
Window\GLFWWindow |
47 | windows, hints, attributes, event loop |
Monitor |
Monitor\GLFWMonitor |
15 | monitors, video modes, gamma |
Input |
Input\GLFWInput |
40 | keys, mouse, cursors, joystick/gamepad, clipboard, time |
Context |
Context\GLFWContext |
6 | make current, swap, proc address |
Vulkan |
Vulkan\GLFWVulkan |
5 | Vulkan support + surface |
GL |
GL\GLFWGL |
8 | minimal OpenGL for visual demos |
Data objects live under Microscrap\Bindings\GLFW\DataObjects. Enums live under Microscrap\Bindings\GLFW\Enums (case names match the C macros exactly; TrueFalse holds GLFW_TRUE / GLFW_FALSE because Bool is reserved in PHP).
Examples
Hidden window (init smoke)
OpenGL clear (needs a display)
Error handling
Nothing in src/ throws. The package keeps GLFW's C conventions:
- creation functions return
nullon failure (?GlfwWindow,?GlfwCursor, …) - call
glfwGetError()for[code, description]
Note: the underlying extension itself may throw RuntimeException from a handful of calls (e.g. failed glfwCreateWindow). Those propagate as-is.
Testing
tests/Unitruns without the extension: coverage drift guard (against a committed 0.5.0 method snapshot), style audit (no class constants, no throws, guarded helpers, backed enums, uppercase cases).tests/Featureis gated onextension_loaded('glfw')and smokes init/version/platform.
License
MIT. See LICENSE.
All versions of glfw with dependencies
ext-glfw Version ^0.5.0|^0.7.0