Download the PHP package calcinai/phpi without Composer

On this page you can find all versions of the php package calcinai/phpi. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package phpi

PHPi

Build Status Latest Stable Version

Event driven bindings for the Raspberry Pi GPIO. Supports A, A+, B, Brev2, B+, 2B, 3B, Compute Module and Pi Zero.

This library interacts (almost) directly with the peripheral registers for maximum functionality and speed. See note on mmap/dma

As there is no ability to mmap in PHP, by default, this has been delegated to a python subprocess. The python has been kept to an absolute minimum (<25 lines) in terms of complexity to allow flexibility at PHP level.

This means that you MUST have python installed alongside PHP for it to function. …sortof

There is also a native PHP extension that is a drop-in replacement for the python subprocess which greatly improves performance. I'd strongly recommend using it, especially with less powerful Pis.

This library will function without any kernel drivers/sysfs etc enabled.

Setup

Using composer:

Although it is possible to add this to your own autoloader, it's not recommended as you'll have no control of the dependencies. If you haven't used composer before, I strongly recommend you check it out at https://getcomposer.org

Usage

All of this code is designed to be run in cli mode, as root to permit the memory access. It is not recommended to try and run this in a synchronous nature (namely under apache/nginx) as this would introduce stability and security issues. See below for more information about webservices.

You can test your install and get a visual display of the pin states by running from the install directory.

The board factory:

Minimal example of reading and setting a pin

Higher level devices and events

GPIO

GPIO (input) is the default mode of the pin objects. Alternate functions can be accessed by using the method. It is recommended to use the function names as opposed to ALT0..5 unless you know exactly what you're doing, as quite a lot are reserved. A few useful classes are also included for digital interaction. With the default python-mmap, you can expect a raw transition speed of ~20kHz, with the native extension, it's more like 80kHz on a Pi 3.

PWM

Hardware PWM is supported by this library, and to an extent, so is soft PWM. As this code runs in the react event loop, it's not practical to interact with the ports more than a few hundred times/sec.

SPI

SPI is supported along with some device protocols (MPC300x etc). With the default python-mmap, it is limited to about 3kB/s before there is no CPU left! With the native extension, you can reach speeds of over 30kB/s.

The event loop

One of the original reasons for basing this project on the react event loop was for the other components that can be leveraged. A good example is the websocket server; it will run seamlessly inline with this library to provide real time, bidirectional, non-polling interaction with the Pi from any modern browser.

See phpi-websocket for more on this.

External Devices

There are included helper classes for interfacing with common devices, with more added regulary.


All versions of phpi with dependencies

PHP Build Version
Package Version
Requires php Version >=5.4.0
calcinai/php-mmap Version ^0.1
react/event-loop Version ^0.4.1
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package calcinai/phpi contains the following files

Loading the files please wait ....