1. Go to this page and download the library: Download php-io-extensions/i2c 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 / i2c example snippets
use Fd\FD;
use I2c\I2CUse;
use I2c\I2CConfig;
$fd = FD::open('/dev/i2c-1', 2); // O_RDWR = 2
// ... use $fd with I2CUse and I2CConfig methods ...
FD::close($fd);