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)

Published by Bramus!

Bramus is a frontend web developer from Belgium, working as a Chrome Developer Relations Engineer at Google. From the moment he discovered view-source at the age of 14 (way back in 1997), he fell in love with the web and has been tinkering with it ever since (more …)

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.