What can PHP Foreign Function Interface do for you?
summary
Covers the PHP Foreign Function Interface (FFI) added in PHP 7.4 and demonstrates how to call C libraries directly from PHP without writing an extension in C. Shows how to prototype PHP wrappers around C libraries, explains common pitfalls and limitations of using FFI, and gives guidance on when FFI is an appropriate solution and when a traditional PHP extension is preferable.
AI-written summary · about
chapters (30)
- 0:00Intro
- 0:56What problems does FFI solve?
- 1:30Why use FFI?
- 2:50Limitation of FFI
- 5:20Configuration Only one configuration option in php.ini, named
- 6:01Let's rewrite PHP abs() function!
- 6:33Talk is cheap, show me the code!
- 6:44How FFI maps functions?
- 8:41Automatic conversion - "right" function call
- 10:35Complex data types - arrays, other observations
- 11:05Complex data types - structures
- 12:07Creating complex data types
- 12:39Passing complex data types
- 13:14Get Unix timestamp for a date
- 13:30A short story about memory...
- 14:12Memory management
- 15:44C pointers FF1
- 17:53Elements of Carrays and structures
- 18:42Complex data types returned by C functions
- 20:10Glob, the function which allocates memory
- 23:31Glob - complete example
- 23:51Callbacks
- 24:33leaks resources
- 26:20Quicksort - definition
- 26:35Quicksort - callback
- 27:13Quicksort - passing callback
- 27:40Quicksort - complete example
- 28:44FFI performance, function calling benchmark
- 30:26Is FFI worth it?
- 32:23PHP FFI re-evaluation, other side
related talks
34mFFI: New horizons for PHP
41mNew Feature: What the Fibers extension can do for you
41mNew Feature: What the Fibers extension can do for you
50mThe La(te)st PHP 7 — What's new in PHP 7.4
01h 02mPolyglot Programming through Foreign Function Interfaces
48mIntroduction to PHP Extensions
43mFunctional Programming in PHP
44mPHP Extension Development with C++
