Skip to content
Non Blocking Io and Firmata for PHP
PHP
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
examples
src
tests
.editorconfig
.gitattributes
.gitignore
.scrutinizer.yml
.travis.yml
README.md
composer.json
composer.lock
phive.xml
phpunit.xml.dist

README.md

Carica Io

Build Status License Total Downloads Latest Stable Version Latest Unstable Version

License: The MIT License

Copyright: 2013-2019 Thomas Weinert thomas@weinert.info

Carica Io is a collection of experimental php classes and scripts for non-blocking I/O. It provides the basic building blocks for hardware control using Firmata (Arduino) and GPIO (Raspberry PI).

Basics

The repository provides the API needed for non-blocking I/O. A simple event loop and event emitter are included. The loop implementation is not performance optimized. However it is possible to use an adapter for ReactPHP or AMPHP.

It includes an (incomplete) HTTP server that should be enough for the first steps. It supports GET requests and WebSocket connections.

Related Projects

           +---------------+
           |  Carica\Chip  |
           +-------+-------+
                   ^
                   |
        +----------+----------+
        |                     |
+-------+-------+    +--------+-------+
|  Carica\GPIO  |    | Carica\Firmata |
+-------+-------+    +--------+-------+
        ^                     ^
        |                     |
        +----------+----------+
                   |
           +-------+-------+
           |   Carica\Io   |
           +---------------+

Carica/Io provides the classes for event based programming and a simple web server. It defines interfaces for hardware control (Pin, ShiftOut, ...). Carica/Firmata is a client library for the Firmata protocol it allows to control Arduino boards over a serial or a network connection. Carica/GPIO implements GPIO into PHP using the file system or the WiringPI library for the Raspberry PI.

Carica/Chip implements classes for hardware objects. Like a LED, a RGB-LED, a Servo,...

Usage

You will need to get the loop instance from the factory, attach events and run it.

$loop = Carica\Io\Event\Loop\Factory::get();
$loop->setInterval(
  static function () {
    static $i = 0;
    echo $i++;
  },
  1000
);
$loop->run();
You can’t perform that action at this time.