A simple, fast, and convenient PHP Extension skeleton project
Pskel is a skeleton project designed to streamline the development of PHP extensions.
It provides a comprehensive toolkit that covers everything from setting up the development environment to continuous integration.
- Utilizes Development Containers and Visual Studio Code
- Automatic installation of necessary extensions
- Simplified configuration for C/C++ development environment
- Support for Valgrind and LLVM Sanitizer
- Integration of external services via docker compose
- Testing across various PHP builds (NTS, ZTS, DEBUG, etc.)
- Easy task execution with the
pskelcommand
- Standard tests (NTS, ZTS)
- Memory leak checks
- LLVM Sanitizer inspections
- Code coverage analysis
- Support for testing on various OS platforms:
- Linux
- macOS
- Windows
- Support for GitHub Codespaces
- Development possible with just a browser
- Install Visual Studio Code
- Install Docker / Docker Compose compatible runtime
- Create a repository using
colopl/pskelas a template - Clone locally, open in VSCode, and select "Open in Container"
- Create a repository using
colopl/pskelas a template - Create a new Codespace from the WebUI under
<> Code->Codespaces
After launching the development environment, run the following command in the terminal:
$ pskel init <YOUR_EXTENSION_NAME> <VENDOR_NAME (PHP >= 8.5 only)>This will create an extension template in the /ext directory.
Additional options available in ext_skel.php are also supported.
We provide a convenient testing environment using the pskel command:
$ pskel test # Test with standard PHP
$ pskel test debug # Test with debug build PHP
$ pskel test gcov # Generate code coverage using GCC Gcov
$ pskel test valgrind # Memory check using Valgrind
$ pskel test msan # Check using LLVM MemorySanitizer
$ pskel test asan # Check using LLVM AddressSanitizer
$ pskel test ubsan # Check using LLVM UndefinedBehaviorSanitizerYou can integrate external services into your development environment by editing the compose.yaml file.
A sample MySQL configuration is included in compose.yaml (commented out).
You can check the code coverage using lcov with the pskel command:
$ pskel coverage
~~~
Reading tracefile /workspaces/pskel/ext/lcov.info
|Lines |Functions |Branches
Filename |Rate Num|Rate Num|Rate Num
==================================================
[/workspaces/pskel/ext/]
bongo.c |75.0% 20|80.0% 5| - 0
==================================================
Total:|75.0% 20|80.0% 5| - 0By enabling GitHub Pages for your repository and enabling Actions deployment, you can view code coverage generated by lcov and genhtml commands on GitHub Pages.
A: Yes. All development tools are pre-installed. For example, to use gdb:
$ gdb --args <php_binary> -dextension=./modules/your_extension_name.so example.phpA: While not recommended, you can use any editor that supports Development Containers.
A: Feel free to ask on GitHub or X (formerly Twitter).
PHP License 3.01