Use C, Rust, Go, etc. code inside PHP with “Foreign Function Interface“ (PHP FFI)

A new extension that comes with PHP 7.4 (which was released today 🎉) is Foreign Function Interface. On the JoliCode Paris website there’s a nice article introducing it:

PHP Foreign Function Interface, or FFI for fans, is a PHP extension that allows you to include with ease some externals libraries into your PHP code. That means it’s possible to use C, Go, Rust, etc. shared library directly in PHP without writing a PHP Extension in C. This concept exists for years in other languages like Python or Go.

Wow, hadn’t heard of that yet.

PHP 7.4 FFI: What you need to know →
PHP Manual: Foreign Function Interface →

(Via Freek)

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.