PHPackages                             se/wired-pi - 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. se/wired-pi

AbandonedArchivedLibrary[Utility &amp; Helpers](/categories/utility)

se/wired-pi
===========

WiredPi is a library for connecting php and the Raspberry Pi GPIO via wiringPi

v0.1-beta(12y ago)318[1 issues](https://github.com/sveneisenschmidt/wired-pi/issues)MITPHPPHP &gt;=5.3.3

Since Dec 1Pushed 12y ago2 watchersCompare

[ Source](https://github.com/sveneisenschmidt/wired-pi)[ Packagist](https://packagist.org/packages/se/wired-pi)[ Docs](https://github.com/sveneisenschmidt/wired-pi)[ RSS](/packages/se-wired-pi/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (1)Dependencies (2)Versions (2)Used By (0)

WiredPi
=======

[](#wiredpi)

[![Latest Stable Version](https://camo.githubusercontent.com/24ad542206ea6c1e7b52a43cc9337edd4067f7ece5d89acac83a884ea59e8baf/68747470733a2f2f706f7365722e707567782e6f72672f73652f77697265642d70692f762f737461626c652e706e67)](https://packagist.org/packages/se/wired-pi)[![SensioLabsInsight](https://camo.githubusercontent.com/742753faa7792edbdf9c6c5a45887f74ebc9f5eb902b017d413cc0e08ea485c5/68747470733a2f2f696e73696768742e73656e73696f6c6162732e636f6d2f70726f6a656374732f30366137333666342d646531332d343535642d396437662d3361356538363564623865612f6d696e692e706e67)](https://insight.sensiolabs.com/projects/06a736f4-de13-455d-9d7f-3a5e865db8ea)

WiredPi is a library for connecting php and the Raspberry Pi GPIO via wiringPi.

#### Dev branch is master branch.

[](#dev-branch-is-master-branch)

[![Build Status](https://camo.githubusercontent.com/f59ced4ff98356e97db95432ebd347206b74d86bb9f33115f2193ad4736c9b02/68747470733a2f2f6170692e7472617669732d63692e6f72672f7376656e656973656e7363686d6964742f77697265642d70692e706e673f6272616e63683d6d6173746572)](https://travis-ci.org/svenseisenschmidt/wired-pi)

##### Table of Contents

[](#table-of-contents)

1. [Installation](#installation)
2. [Usage](#usage)
    - [Basic](#basic-usage)
    - [Read pin](#read-pin)
    - [Prototyping server](#prototyping-server)

Installation
------------

[](#installation)

The recommended way to install is through [Composer](http://getcomposer.org).

```
{
    "require": {
        "se/wired-pi": "dev-master"
    }
}
```

WiredPi uses internally the WiringPi library. A big thank you [@drogon](https://twitter.com/drogon). To install it follow the following steps:

```
$ cd /opt
$ sudo mkdir wiringpi
$ sudo chown $USER ./wiringpi
$ cd wiringpi
$ git clone git://git.drogon.net/wiringPi ./
$ git pull origin
$ ./build
```

(The package git-core is needed for git operations. Install it via *sudo apt-get install git-core*. )

Usage
-----

[](#usage)

### Basic usage

[](#basic-usage)

Require the composer autload file and create a new Board.

```
require_once __DIR__.'/vendor/autoload.php';

use \SE\Component\WiredPi;

$platform = new WiredPi\Platform\RaspberryPi();
$board = new WiredPi\Board($platform);
```

The next step is to apply a port map to the port so it knows what pins can be controlled.

```
$map = new WiredPi\PortMap(array(
    // number of the GPIO-pin,
    18
    // you can set default options too, STATE_ON turns the pin by default on
    23 => array(WiredPi\Port::STATE => WiredPi\Port::STATE_ON)
));
```

Now add the port map to your board instance and refresh it. The settings take effect immediately.

```
$board->setPorts($map);
$board->refresh(); // applies the current state to the microcontroller

// Modification of ports need to be applied again
$board->getPort(18)->on();
$board->refresh();
```

### Read pin

[](#read-pin)

For reading the status of your pin you can use the platform instance you passed to the board.

```
$port = $board->getPort(18);
$status = $platform->read($port); // returns 0 or 1
```

By default the pins are set to OUT.

For receiving the status of a pin from IN set the mode to IN.

```
$port = $board->getPort(18);
$port->setMode(WiredPi\Port::MODE_IN);

// Do something when Pin switches to 1
while(true) {

    if($platform->read($port) == '1') {
        print sprintf('Pin %s went to %s', $port, '1')
        break;
    }
    usleep(5000); // Let the system catch up
}
```

### Prototyping server

[](#prototyping-server)

WiredPi includes a protyping server to control pins without the need to setup them from within a php script. Run it by using the built in php server (Since PHP 5.4.0).

```
$ php -S localhost:8000 scripts/server.php
```

[![](https://camo.githubusercontent.com/dacfa2dd4e95dff823206432ff4d5c41e68b5903ef5cf6e2222cf72e3c65db24/68747470733a2f2f646c2e64726f70626f7875736572636f6e74656e742e636f6d2f752f33363032383231342f4769744855622f77697265642d70692d7365727665722e706e67)](https://camo.githubusercontent.com/dacfa2dd4e95dff823206432ff4d5c41e68b5903ef5cf6e2222cf72e3c65db24/68747470733a2f2f646c2e64726f70626f7875736572636f6e74656e742e636f6d2f752f33363032383231342f4769744855622f77697265642d70692d7365727665722e706e67)

For more examples have a look at *examples/*.

###  Health Score

21

—

LowBetter than 19% of packages

Maintenance13

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity44

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

4548d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/d10b5597487e04e0a3a673775a4aef48e6bf1d07712c0024dc2671f844648805?d=identicon)[sveneisenschmidt](/maintainers/sveneisenschmidt)

---

Top Contributors

[![sveneisenschmidt](https://avatars.githubusercontent.com/u/62278?v=4)](https://github.com/sveneisenschmidt "sveneisenschmidt (26 commits)")

---

Tags

GPIOwiringPi

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/se-wired-pi/health.svg)

```
[![Health](https://phpackages.com/badges/se-wired-pi/health.svg)](https://phpackages.com/packages/se-wired-pi)
```

###  Alternatives

[illuminate/session

The Illuminate Session package.

9937.4M753](/packages/illuminate-session)[codefog/contao-haste

haste extension for Contao Open Source CMS

42650.8k139](/packages/codefog-contao-haste)[piphp/gpio

A library for accessing the GPIO pins on a Raspberry Pi

4325.9k2](/packages/piphp-gpio)[ronanguilloux/php-gpio

GPIO-related utils &amp; toolkit PHP library

2678.0k](/packages/ronanguilloux-php-gpio)[leapt/core-bundle

Symfony LeaptCoreBundle

2529.1k4](/packages/leapt-core-bundle)[robole/sulu-ai-translator-bundle

Translate any type of content using DeepL

181.3k](/packages/robole-sulu-ai-translator-bundle)

PHPackages © 2026

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