php[tek] 2024 php[tek] 2024 Login
Writing PHP Extensions
Speaker: Derick Rethans
Writing PHP Extensions

Level: Advanced
Length: Tutorial (3 hours)

Description:
In this workshop, you will learn how to write a PHP extension. We will start by converting a function that we already have in PHP code into C, which we will then wrap in a PHP extension. This will show what performance benefits you can expect by converting an algorithm. Secondly, we will then look at wrapping the data structure that the function operates on into a class, with the initial function converted to a method. And then lastly we will add multiple methods to finish up. What You Will Learn - How PHP's build system works. - How PHP handlers memory management and types. - How to write a basic extension with procedural functions and OO. - Where extensions would not be useful. Required For understanding the tutorial: - Some knowledge of C For taking part in the exercises: - A Linux machine or Linux VM - Compilers installed (apt-get install php-dev, or similar) - GIT, valgrind, and gdb installed (all through apt, or similar) - GIT clone of the php-src repository (https://github.com/php/php-src.git)

Thanks to our php[tek] 2025 sponsors!
PHP Architect
(Platinum)