Download .zip |
Info | Example | View files (71) | Download .zip | Reputation | Support forum | Blog | Links |
Last Updated | Ratings | Unique User Downloads | Download Rankings | |||||
2018-04-30 (4 months ago) | Not yet rated by the users | Total: 147 This week: 1 | All time: 8,604 This week: 468 |
Version | License | PHP version | Categories | |||
phpiwire 1.0.0 | Free For Educatio... | 5 | Hardware, Zephir |
A wrapper for wiringPi written in Zephir so that is can be compiled as an extension for PHP.
This extension and the wiringPi library are intended to run on a RaspberryPi, so having a RaspberryPi is kind of a big requirement here! You also need to have Git installed, the wiringPi library, various build tools and the php development headers.
sudo apt-get update
sudo apt-get install git
git clone git://git.drogon.net/wiringPi
cd wiringPi
./build
If all goes well you should be able to run the gpio utility:
gpio -v
Full instructions for installing wiringPi.
sudo apt-get install gcc make re2c php5 php5-json php5-dev libpcre3-dev
git clone https://github.com/phalcon/zephir
cd zephir
./install-json
./install -c
If all goes well you should be able to get the help info for zephir:
zephir help
Full instructions for installing zephir.
git clone https://github.com/amnuts/phpiwire
cd phpiwire
zephir build
That will build and install the extension. You'll then have to add the extension to your php.ini file. You may find that you have two php.ini files, one for cli and one for web, so remember to add the extension to both. You'll want to add the line:
extension=phpiwire.so
Once this is done (and the web server restarted if you're adding the extension for web use and not just cli) you should be able to see the extension info when using the `
phpinfo()`
method or via the command line `
php -i`
.
Here's a very simple example of how to make an LED attached to pin 0 (using the wiringPi pin numbering scheme, BCM_GPIO pin 17) blink on and off.
Assuming the LED is attached as shown:
<?php
namespace Phpiwire;
set_time_limit(0);
echo "Raspberry Pi blink\n";
$pi = new Board();
$p = $pi->getPin(0)->mode(Pin::OUTPUT);
while (true) {
$p->write(Pin::HIGH);
sleep(1);
$p->write(Pin::LOW);
sleep(1);
}
And to run it you'll need to be running as root:
sudo php blink.php
Releases of the extension are available at:
https://github.com/amnuts/phpiwire/releases/
MIT: http://acollington.mit-license.org/
Files |
File | Role | Description | ||
---|---|---|---|---|
example (7 files, 1 directory) | ||||
ext (1 directory) | ||||
phpiwire (2 files) | ||||
composer.json | Data | Auxiliary data | ||
config.json | Data | Auxiliary data | ||
phpstorm-stub.php | Class | Class source | ||
README.md | Doc. | Documentation |
Files | / | example |
File | Role | Description | ||
---|---|---|---|---|
ajax-example (4 files) | ||||
blink.php | Example | Example script | ||
board.php | Example | Example script | ||
pin.php | Example | Example script | ||
pulse.php | Example | Example script | ||
reset.php | Example | Example script | ||
rgbled.php | Example | Example script | ||
softpwm.php | Example | Example script |
Files | / | example | / | ajax-example |
File | Role | Description |
---|---|---|
control.php | Aux. | Auxiliary script |
index.html | Doc. | Documentation |
_reset.php | Example | Example script |
_set.php | Example | Example script |
Files | / | ext | / | kernel |
File | Role | Description | ||
---|---|---|---|---|
extended (4 files) | ||||
array.c | Data | Auxiliary data | ||
array.h | Data | Auxiliary data | ||
assert.c | Data | Auxiliary data | ||
assert.h | Data | Auxiliary data | ||
backtrace.c | Data | Auxiliary data | ||
backtrace.h | Data | Auxiliary data | ||
concat.c | Data | Auxiliary data | ||
concat.h | Data | Auxiliary data | ||
debug.c | Data | Auxiliary data | ||
debug.h | Data | Auxiliary data | ||
exception.c | Data | Auxiliary data | ||
exception.h | Data | Auxiliary data | ||
exit.c | Data | Auxiliary data | ||
exit.h | Data | Auxiliary data | ||
fcall.c | Data | Auxiliary data | ||
fcall.h | Data | Auxiliary data | ||
file.c | Data | Auxiliary data | ||
file.h | Data | Auxiliary data | ||
filter.c | Data | Auxiliary data | ||
filter.h | Data | Auxiliary data | ||
globals.h | Data | Auxiliary data | ||
hash.c | Data | Auxiliary data | ||
hash.h | Data | Auxiliary data | ||
iterator.c | Data | Auxiliary data | ||
iterator.h | Data | Auxiliary data | ||
main.c | Data | Auxiliary data | ||
main.h | Data | Auxiliary data | ||
math.c | Data | Auxiliary data | ||
math.h | Data | Auxiliary data | ||
memory.c | Data | Auxiliary data | ||
memory.h | Data | Auxiliary data | ||
object.c | Data | Auxiliary data | ||
object.h | Data | Auxiliary data | ||
operators.c | Data | Auxiliary data | ||
operators.h | Data | Auxiliary data | ||
output.c | Data | Auxiliary data | ||
output.h | Data | Auxiliary data | ||
persistent.c | Data | Auxiliary data | ||
persistent.h | Data | Auxiliary data | ||
README.md | Doc. | Documentation | ||
require.c | Data | Auxiliary data | ||
require.h | Data | Auxiliary data | ||
session.c | Data | Auxiliary data | ||
session.h | Data | Auxiliary data | ||
string.c | Data | Auxiliary data | ||
string.h | Data | Auxiliary data | ||
time.c | Data | Auxiliary data | ||
time.h | Data | Auxiliary data | ||
variables.c | Data | Auxiliary data | ||
variables.h | Data | Auxiliary data |
Version Control | Unique User Downloads | Download Rankings | |||||||||||||||
100% |
|
|
Applications that use this package |
If you know an application of this package, send a message to the author to add a link here.