1. Go to this page and download the library: Download php-io-extensions/metal 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 / metal example snippets
use Metal\MTL\App;
use Metal\MTL\Device;
use Metal\MTL\Menu;
use Metal\MTL\Window;
App::init();
Menu::installDefault('My App');
Menu::addItem('Demo', 'Quit Demo', 'q', 'quit');
$window = Window::create('Metal', 800, 600);
$device = Device::createSystemDefault();
Window::attachDevice($window, $device);
while (!Window::shouldClose($window) && !App::shouldQuit()) {
App::poll();
if (Menu::pollAction() === 'quit') {
break;
}
Window::clear($window, 30, 30, 40, 255);
usleep(16_000);
}
Window::destroy($window);
Device::release($device);