swoole / make-library
Installs: 369
Dependents: 0
Suggesters: 0
Security: 0
Stars: 5
Watchers: 3
Forks: 0
Open Issues: 0
Type:utils
Requires
- php: >=8.0
This package is auto-updated.
Last update: 2024-10-16 08:35:01 UTC
README
Convert PHP
code to C/C++
header file
Edit __init__.php
Edit the __init__.php
file in the source code directory, the make-library
script will read this file to configuration.
# file: __init__.php <?php return [ 'name' => 'swoole', // Library name 'checkFileChange' => false, // Check if there are uncommitted changes in the git repository 'output' => '/your/c_header_file_path', // Generated C/C++ header file path 'stripComments' => true, // Whether to keep comments /* Notice: Sort by dependency */ 'files' => [ # <basic> # 'constants.php', # <std> # 'std/exec.php', # <core> # 'core/Constant.php', # ... more files # ] ];
Make header file
composer require swoole/make-library
vendor/bin/make-library.php ./src
The first parameter is the source code path, there must exist __init__.php
in this directory.
Loader library in php extension
#include "php_{$libaryName}_library.h" // execute in RINIT function php_{$libaryName}_load_library();