Download the PHP package php-io-extensions/fd without Composer

On this page you can find all versions of the php package php-io-extensions/fd. 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 fd

FD

PHP Zephir Platform

PHP-controllable UNIX file descriptor extension built with Zephir.

The FD extension allows PHP to open raw UNIX file descriptors, enabling control beyond simple stream-based I/O. The integer descriptor can be passed into other extensions or used directly for system-level interfaces such as GPIO, I2C, SPI, and UART.

Requirements

Installation

Via PHP PIE (recommended)

PHP PIE is the official PHP extension installer. It handles the full build and activation pipeline automatically.

Install PIE if you haven't already:

Then install the extension:

PIE will build the extension from source, copy the .so into PHP's extension directory, and write the ini activation file. No Zephir required — the C source is pre-generated in the package.

Manual installation

Clone the repository and run the bundled installer script. PHP dev headers and gcc must be present; Zephir is not required.

The script builds from the pre-generated C source in ext/, installs the .so, and enables the extension across all detected SAPIs (CLI, FPM, Apache).

Verifying installation

Usage

All methods are static on the Fd\FD class.

Flags

$flags parameters accept plain integers. They map directly to the POSIX constants from fcntl.h — PHP does not define these, so pass the values directly or define your own:

Constant Linux macOS
O_RDONLY 0 0
O_WRONLY 1 1
O_RDWR 2 2
O_NONBLOCK 2048 4

Combine multiple flags with the bitwise OR operator (|):


FD::open

Opens a file or device and returns a file descriptor integer.

Returns the file descriptor on success, or a negative value on failure.


FD::close

Closes an open file descriptor.

Returns 0 on success, -1 on failure.


FD::addFlags

Adds file status flags to an open file descriptor using fcntl. Existing flags are preserved; the provided flags are OR'd in.

Returns 0 on success, -1 on failure. Useful for setting a descriptor non-blocking after it has already been opened.


FD::read

Reads up to $bytes_to_read bytes from a file descriptor and returns them as a string.

Returns the bytes read as a binary string. Returns an empty string on error. A zero-length read (e.g. EOF) also returns an empty string, so callers that need to distinguish the two cases should check the descriptor state beforehand.


FD::write

Writes bytes to a file descriptor.

Returns the number of bytes written on success, or -1 on failure.


Example: I2C Read/Write

License

Project Saturn Studios, LLC.


All versions of fd 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 php-io-extensions/fd contains the following files

Loading the files please wait ...