/php-ffi-samples

Sample PHP & C programs to understand how PHP-FFI works

Primary LanguagePHPApache License 2.0Apache-2.0

PHP-FFI samples

CircleCI

Requirements

  • PHP 7.4 with FFI enabled
  • go 1.3 or higher
  • gcc

how to check

checkout this repository

$ make
$ composer install
$ ./vendor/bin/phpunit

PHP-FFI with C

  • src/lib/sample.c
  • src/ArgumentsampleC

PHP-FFI with Go

Basically, use c code as interface to prevent seg fault.

  • src/lib/go-sample.c
  • src/ArgumentsampleGo