sheunl / phpext-skeleton
Create a PHP extension skeleton using ext_skel.php
v0.0.2
2026-04-04 05:29 UTC
Requires
- php: >=8.2
README
A tool to quickly generate PHP extension skeletons with all necessary boilerplate code and build configuration files base on the PHP source ext_skel.php script.
Installation
Global Installation (Recommended)
composer global require sheunl/phpext-skeleton
Make sure your global Composer bin directory is in your PATH:
export PATH="$HOME/.composer/vendor/bin:$PATH" # or export PATH="$HOME/.config/composer/vendor/bin:$PATH"
Local Installation
composer require --dev sheunl/phpext-skeleton
Usage
Create a New Extension
php-start-extension --ext extension_name [--vendor vendor_name] [--author "Your Name"]
Options
--ext- Extension name (required)--vendor- Vendor/namespace name (required)--author- Author name (optional)--dir- Directory to create extension in (default: current directory)--experimental- Mark extension as experimental--std- Use standard extension template--onlyunix- Generate only Unix build files--onlywindows- Generate only Windows build files
Examples
Create a simple extension:
php-start-extension --ext myext
Create an extension with vendor namespace:
php-start-extension --ext myext --vendor mycompany
Create an extension with author information:
php-start-extension --ext myext --author "John Doe"
Building Your Extension
Once the skeleton is created, navigate to the extension directory and build:
Linux/Unix
cd myext phpize ./configure make make test sudo make install
Enable the Extension
Add to your php.ini:
extension=myext.so
Or load it directly:
php -dextension=./modules/myext.so -m | grep myext
Directory Structure
The generated extension includes:
config.m4- Unix build configurationconfig.w32- Windows build configurationphp_[ext].h- Header file[ext].c- Main extension source[ext].stub.php- Stub file for arginfo generation[ext]_arginfo.h- Generated argument infotests/- Test files directorycomposer.json- Composer configuration
Requirements
- PHP >= 8.2
- Build tools (gcc, make, autoconf, etc.)
License
PHP-3.01
Contributing
Contributions are welcome! Please feel free to submit issues or pull requests.