2017 © Pedro Peláez
 

library gpio

A RaspberryPi GPIO library written in PHP.

image

ballen/gpio

A RaspberryPi GPIO library written in PHP.

  • Sunday, February 11, 2018
  • by allebb
  • Repository
  • 2 Watchers
  • 8 Stars
  • 60 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 6 Versions
  • 15 % Grown

The README.md

GPIO

Build Code Coverage Scrutinizer Code Quality Code Climate Latest Stable Version Latest Unstable Version License, (*1)

A RaspberryPi GPIO library written in PHP, This library makes it a breeze to work with simple inputs and outputs such as buttons, switches, LED's, motors and relays., (*2)

Requirements

  • PHP >= 7.3.0

This library is unit tested against PHP 7.3, 7.4, 8.0, 8.1 and 8.2!, (*3)

If you need to use an older version of PHP, you should instead install the 1.x version of this library (see below for details)., (*4)

License

This library is released under the GPLv3 license, you are welcome to use it, improve it and contribute your changes back!, (*5)

Installation

The recommended way of installing the latest version of this library is via. Composer; To install using Composer type the following command at the console:, (*6)

composer require ballen/gpio

If you need to use an older version of PHP, version 1.x.x supports PHP 7.1 and 7.2, you can install this version using Composer with this command instead:, (*7)

composer require ballen/gpio ^1.0

Example usage

An example of a flashing a single LED:, (*8)

use Ballen\GPIO\GPIO;

// Create a new instane of the GPIO class.
$gpio = new GPIO();

// Configure our 'LED' output...
$led = $gpio->pin(18, GPIO::OUT);

// Create a basic loop that runs continuously...
while (true) {
    // Turn the LED on...
    $led->setValue(GPIO::HIGH);
    // Wait for one second...
    sleep(1);
    // Turn off the LED...
    $led->setValue(GPIO::LOW);
    // Wait for one second...
    sleep(1);
}

Tests and coverage

This library is fully unit tested using PHPUnit., (*9)

I use GitHub Actions for continuous integration, which triggers tests for PHP 7.3, 7.4, 8.0, 8.1 and 8.2 every time a commit is pushed., (*10)

If you wish to run the tests yourself you should run the following:, (*11)

# Install the GPIO Library (which will include PHPUnit as part of the require-dev dependencies)
composer install

# Now we run the unit tests (from the root of the project) like so:
./vendor/bin/phpunit

Code coverage can also be run and a report generated (this does require XDebug to be installed)..., (*12)

./vendor/bin/phpunit --coverage-html ./report

Support

I am happy to provide support via. my personal email address, so if you need a hand drop me an email at: ballen@bobbyallen.me., (*13)

The Versions

11/02 2018

dev-master

9999999-dev

A RaspberryPi GPIO library written in PHP.

  Sources   Download

GPLv3 GPL-3.0-or-later

The Requires

  • php >=7.0.0

 

The Development Requires

gpio rpi raspberrypi io

25/08 2017

1.0.4

1.0.4.0

A RaspberryPi GPIO library written in PHP.

  Sources   Download

GPLv3

The Requires

  • php >=7.0.0

 

The Development Requires

gpio rpi raspberrypi io

25/08 2017

1.0.3

1.0.3.0

A RaspberryPi GPIO library written in PHP.

  Sources   Download

GPLv3

The Requires

  • php >=7.0.0

 

The Development Requires

gpio rpi raspberrypi io

24/08 2017

1.0.2

1.0.2.0

A RaspberryPi GPIO library written in PHP.

  Sources   Download

GPLv3

The Requires

  • php >=7.0.0

 

The Development Requires

gpio rpi raspberrypi io

22/08 2017

1.0.1

1.0.1.0

A RaspberryPi GPIO library written in PHP.

  Sources   Download

GPLv3

The Requires

  • php >=7.0.0

 

The Development Requires

gpio rpi raspberrypi io

22/08 2017

1.0.0

1.0.0.0

A RaspberryPi GPIO library written in PHP.

  Sources   Download

GPLv3

The Requires

  • php >=7.0.0

 

The Development Requires

gpio rpi raspberrypi io