PHPackages                             embedded-php/spi - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. embedded-php/spi

ActivePhp-ext[Utility &amp; Helpers](/categories/utility)

embedded-php/spi
================

An object-oriented wrapper to the spidev Linux Kernel driver

411[2 PRs](https://github.com/embedded-php/ext-spi/pulls)CCI passing

Since Dec 23Pushed 3mo ago1 watchersCompare

[ Source](https://github.com/embedded-php/ext-spi)[ Packagist](https://packagist.org/packages/embedded-php/spi)[ RSS](/packages/embedded-php-spi/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (3)Used By (0)

SPI PHP Extension
=================

[](#spi-php-extension)

The SPI PHP Extension provides an object-oriented wrapper to the [spidev](https://www.kernel.org/doc/Documentation/spi/spidev) Linux Kernel driver that gives users the ability to write code that interacts with external hardware using the [SPI](https://en.wikipedia.org/wiki/Serial_Peripheral_Interface)protocol.

Requirements
------------

[](#requirements)

- PHP &gt;= 8.0 (either NTS or ZTS version);

> **Note:** if you are using this extension on Raspbian or Raspberry Pi OS, the user executing the script **must**belong to the **spi** group or you may run into "Permission denied" errors.

On **Raspbian** or **Raspberry Pi OS**:

**PHP 8.0**:

```
sudo apt install php8.0-cli php8.0-dev php8.0-phpdbg
```

**PHP 8.1**:

```
sudo apt install php8.1-cli php8.1-dev php8.1-phpdbg
```

Building
--------

[](#building)

```
phpize
./configure
make
make test
```

SPI Modes
---------

[](#spi-modes)

ModeConstantDescription00SPI\\MODE\_0Clock idle low, data valid at beginning of pulse (low to high)01SPI\\MODE\_1Clock idle low, data valid at end of pulse (high to low)10SPI\\MODE\_2Clock idle high, data valid at beginning of pulse (high to low)11SPI\\MODE\_3Clock idle high, data valid at end of pulse (low to high)Stubs
-----

[](#stubs)

After changing any of the [stubs](stubs/), the main [stub file](phpspi.stub.php) must be updated by running the command below.

```
php stubs/update-main-stup.php
```

Once the stub is updated, the regular build process can be executed.

> **Note:** The main stub file ([phpspi.stub.php](phpspi.stub.php)) is a generated file, edit the files on the [stubs](stubs/) folder instead.

Constants
---------

[](#constants)

All namespace defined constants can be seen in the [Constants.php](stubs/Constants.php) stub.

Classes
-------

[](#classes)

ClassDescription[SPI\\Bus](stubs/Bus.php)Represents a SPI Bus.[SPI\\Exception](stubs/Exception.php)Base exception.Resources
---------

[](#resources)

-
-

Alternatives
------------

[](#alternatives)

- [frak/php\_spi](https://github.com/frak/php_spi)
- [Volantus/berry-spi](https://github.com/Volantus/berry-spi)

Other Languages
---------------

[](#other-languages)

- Golang: [periph/conn](https://github.com/periph/conn)
- NodeJS: [alexeden/spi-node](https://github.com/alexeden/spi-node)
- NodeJS: [fivdi/spi-device](https://github.com/fivdi/spi-device)
- NodeJS: [natevw/pi-spi](https://github.com/natevw/pi-spi)
- Python: [doceme/py-spidev](https://github.com/doceme/py-spidev)

License
-------

[](#license)

This library is licensed under the [PHP License](LICENSE).

###  Health Score

21

—

LowBetter than 18% of packages

Maintenance53

Moderate activity, may be stable

Popularity6

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity16

Early-stage or recently created project

 Bus Factor1

Top contributor holds 75% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/42b9c9cbc06973a61587667fc811b853f4d71843f35ba2535f3900083e69ab3f?d=identicon)[flavioheleno](/maintainers/flavioheleno)

---

Top Contributors

[![flavioheleno](https://avatars.githubusercontent.com/u/471860?v=4)](https://github.com/flavioheleno "flavioheleno (18 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (6 commits)")

---

Tags

hacktoberfestphpphp-extensionspispi-library

### Embed Badge

![Health badge](/badges/embedded-php-spi/health.svg)

```
[![Health](https://phpackages.com/badges/embedded-php-spi/health.svg)](https://phpackages.com/packages/embedded-php-spi)
```

###  Alternatives

[echo511/plupload

Plupload component for Nette Framework.

104.4k1](/packages/echo511-plupload)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
