This repository is a collection of sample features for a php extension. Each branch implements a single feature. Basically I add my tests as branches as I am learning and experimenting.
The minimum version is PHP 8 (originally PHP 7). I am not going to implement BC for older versions.
Join the Stackoverflow Chat Room 11
Inside the extension directory:
- Initialize with
phpize
- Configure with
./configure
- Compile with
make
PHP uses PHPT files for tests. The format is documented on the phpQA pages.
make test
will compile your extension and run the tests.
PHP needs argument information for the functions and methods. Since PHP 8 you can define the stubs in PHP and generate the argument information from them.
Create a php file that ends with .stub.php
. Define the your extension API as empty stubs.
Call build/gen_stubs.php
from the main php repository inside the extension directory to
generate/update the argument information.
$ ../php-src/build/gen_stubs.php
If all goes well this will result in a C header file that ends with _arginfo.h
for each stub file that
you can include in the extension C file.