PHP 7.4's FFI Support Is In Good Shape For Tapping C Functions / Structures From PHP
One of the interesting features for PHP 7.4 that is due for release at the end of next month is the long-awaited FFI (Foreign Function Interface) support. PHP 7.4's FFI lets developers call functions / variables / data structures defined in the C programming language from native PHP code.
FFI is one of the prominent new features to PHP 7.4 along with the preload feature, hardening the PHP FPM systemd service, TLS 1.3 for OpenSSL streams, and many other changes. The PHP 7.4 FFI approach is comparable to that of FFI implementations for other languages.
Usage of PHP FFI moving forward should yield less of a need for writing new PHP modules for interfacing with C libraries/programs while now can be done using the foreign function interface. For those curious about sample code / examples for PHP 7.4 FFI, Fedora/RedHat PHP packager Remi Collet has written a new blog post outlining some of the use-cases with example code.
Those wishing to learn more about the PHP 7.4 FFI support can also see the documentation on PHP.net and their basic examples. There still are a few more PHP 7.4 release candidates ahead while the general availability is still slated to happen on/around the 28 November.
FFI is one of the prominent new features to PHP 7.4 along with the preload feature, hardening the PHP FPM systemd service, TLS 1.3 for OpenSSL streams, and many other changes. The PHP 7.4 FFI approach is comparable to that of FFI implementations for other languages.
Usage of PHP FFI moving forward should yield less of a need for writing new PHP modules for interfacing with C libraries/programs while now can be done using the foreign function interface. For those curious about sample code / examples for PHP 7.4 FFI, Fedora/RedHat PHP packager Remi Collet has written a new blog post outlining some of the use-cases with example code.
Those wishing to learn more about the PHP 7.4 FFI support can also see the documentation on PHP.net and their basic examples. There still are a few more PHP 7.4 release candidates ahead while the general availability is still slated to happen on/around the 28 November.
6 Comments