PHP code example of php-io-extensions / glfw

1. Go to this page and download the library: Download php-io-extensions/glfw library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

php-io-extensions / glfw example snippets



use Glfw\GLFW\GLFW;
use Glfw\GLFW\Window\GLFWWindow;
use Glfw\GLFW\Context\GLFWContext;

GLFW::glfwInit();

// GLFW_VISIBLE = 0x00020004 — prefer microscrap enums in real apps
GLFWWindow::glfwWindowHint(0x00020004, 0);
$window = GLFWWindow::glfwCreateWindow(800, 600, 'Hello GLFW');

while (!GLFWWindow::glfwWindowShouldClose($window)) {
    GLFWWindow::glfwPollEvents();
    GLFWContext::glfwSwapBuffers($window);
}

GLFWWindow::glfwDestroyWindow($window);
GLFW::glfwTerminate();
bash
# Headless smoke
php -n -d extension=ext/modules/glfw.so examples/proof_of_work.php

# Monitors / video modes
php -n -d extension=ext/modules/glfw.so examples/proof_monitor.php

# Visual window (rainbow clear + bouncing rect — ESC to quit)
php -n -d extension=ext/modules/glfw.so examples/proof_window.php