Download the PHP package tasoft/php-i2c-extension without Composer

On this page you can find all versions of the php package tasoft/php-i2c-extension. 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 php-i2c-extension

The PHP i2c Extension

I've created this extension to get access to the i2c bus on my raspberry pi.

Prerequisites

Installation

Change the configure file on line 5 (php-config7.4), to match your installed version of PHP. Then, run the following commands to install the extension.

Next, find the location of PHP's INI files on your computer by running the following command.

Note: If you're using Microsoft Windows, then run php --ini and look for the value of "Configuration File (php.ini) Path:".

You should see a directory path such as /etc/php/7.4/cli. In that directory, create a new INI file named 20-i2c.ini with the following contents

Then, with the file created, test that the I2C extension is loaded by running the following command:

You should see the following output:

Usage

The extension adds five function to the global scope:

  1. This opens the device bus.

  2. This selects an address of a connected chip.

  3. Reads data from the i2c bus.

  4. Writes data to the i2c bus

  5. Closes the bus.

Example

I've tested with a Raspberry Pi Model B 3+ and the Adafruit ADS1115 analog to digital converter. It's default i2c address is 0x48.

Usage PHP

The package also contains a php wrapper class for i2c.

Please note that the composer installation does not compile the extension! For compilation use the installation guide described before.

Now the same example can be rewritten as:


All versions of php-i2c-extension with dependencies

PHP Build Version
Package Version
Requires php Version >=8.0
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 tasoft/php-i2c-extension contains the following files

Loading the files please wait ....