PHP code example of gpio / digital

1. Go to this page and download the library: Download gpio/digital 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/ */

    

gpio / digital example snippets


use GeneralPurposeIO\Digital\DigitalIO;

// Adapter name from config/gpio.php (default often "posix")
$factory = DigitalIO::adapter('posix')->device(0); // /dev/gpiochip0
$output = $factory->output(17);
$output->write(true);