Skip to content
@php-ffi

PHP FFI

PHP FFI General Purpose Libraries

PHP FFI

PHP FFI

Preprocess and parse C headers, inspect native binaries and locate them on disk — in plain PHP.

Documentation  ·  Packagist  ·  Repositories


A set of independent Composer packages around PHP's FFI extension. They cover the whole path from a C header and a shared library to working FFI bindings: the header is preprocessed and parsed into an AST, and the library is found on disk and its exported symbols are read — without a C compiler or any native tooling. All packages are written in pure PHP and work on Linux, macOS and Windows.

Packages

C headers

Binaries

  • ffi/reflection-library — reads ELF, PE/COFF and Mach-O binaries: exported and imported symbols.

    Tests Version PHP

  • ffi/location — resolves the physical path of a binary in the operating system.

    Tests Version PHP

Runtime

  • ffi/env — status and availability of the FFI extension in the current environment.

    Tests Version PHP

Installation

Every package is installed separately with Composer:

composer require ffi/c-parser

Contributing

Bug reports and pull requests are welcome in the repository of the package they relate to. Please run its test suite (composer test:unit) and code style check (composer phpcs:check) before opening a pull request.

License

All packages are open-source software released under the MIT License.

Pinned Loading

  1. preprocessor preprocessor Public

    PHP FFI-compatible ISO/IEC 9899:2024 (С23) preprocessor implementation

    PHP 24

  2. c-parser c-parser Public

    PHP FFI-compatible ISO/IEC 9899:2024 (С23) parser implementation

    C 2

  3. location location Public

    PHP library for determining the physical location of binaries

    PHP 13

  4. reflection-library reflection-library Public

    Provides basic information about libraries for working with PHP FFI

    PHP 4

Repositories

Showing 10 of 13 repositories

Top languages

Loading…

Most used topics

Loading…