PHP code example of tasoft / php-spi-extension

1. Go to this page and download the library: Download tasoft/php-spi-extension 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/ */

    

tasoft / php-spi-extension example snippets



var_dump( extension_loaded('php_spi') ); // Should be true


use TASoft\Bus\SPI;

$dev = new SPI(0); // /dev/spidev0.0
$backData = $dev->transfer([0x0, 0xFF]);
print_r($backData);
bin
$ cd ~
$ git clone https://github.com/tasoftch/php-spi-extension.git
$ cd php-spi-extension
$ phpize
$ ./configure --enable-php-spi
$ make
$ sudo make install
bin
$ php --ini