add php extension with pecl packaging support#26
Merged
MuriloChianfa merged 2 commits intomainfrom Jan 31, 2026
Merged
Conversation
MuriloChianfa
added a commit
that referenced
this pull request
Jan 31, 2026
* add python bindings with cython and pypi packaging support * add php extension with pecl packaging support (#26) * add php extension with pecl packaging support * fixing php binding test ci * add python bindings with cython and pypi packaging support * Fix Python bindings Cython import issue Remove incorrect self-import in _liblpm.pyx that was causing compilation failure. Cython automatically imports the corresponding .pxd file, so explicit cimport _liblpm was creating a circular dependency. All references updated to use types/functions directly. * adapting to ts and dl versions of libdynemit to run the python binding
MuriloChianfa
added a commit
that referenced
this pull request
Jan 31, 2026
Resolved conflicts in: - .github/workflows/ci.yml: Added Lua, Perl, PHP, and Python bindings tests - CMakeLists.txt: Combined Lua, Perl, PHP, and Python wrapper options - docker/README.md: Documented all language binding containers - scripts/docker-build.sh: Added support for all binding images This merge brings in the Perl (#28), Python (#27), and PHP (#26) bindings alongside the existing Lua bindings work.
MuriloChianfa
added a commit
that referenced
this pull request
Jan 31, 2026
Resolved conflicts in: - .github/workflows/ci.yml: Added C#, Lua, Perl, PHP, and Python bindings tests - CMakeLists.txt: Combined C#, Lua, Perl, PHP, and Python wrapper options - docker/README.md: Documented all language binding containers - scripts/docker-build.sh: Added support for all binding images This merge brings in the Lua (#29), Perl (#28), Python (#27), and PHP (#26) bindings alongside the existing C# bindings work.
MuriloChianfa
added a commit
that referenced
this pull request
Jan 31, 2026
Resolved conflicts in: - .github/workflows/ci.yml: Added Java, C#, Lua, Perl, PHP, and Python bindings tests - CMakeLists.txt: Combined Java, C#, Lua, Perl, PHP, and Python wrapper options - docker/README.md: Documented all language binding containers - scripts/docker-build.sh: Added support for all binding images This merge brings in the C# (#31), Lua (#29), Perl (#28), Python (#27), and PHP (#26) bindings alongside the existing Java bindings work.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR adds comprehensive PHP bindings for liblpm, providing native PHP extension support for high-performance Longest Prefix Match (LPM) operations. The implementation includes both object-oriented and procedural APIs, full IPv4/IPv6 support, batch operations, and PECL packaging for easy distribution.
Type of Change
Related Issues
Related to language bindings expansion
Motivation and Context
PHP is widely used in web applications and network infrastructure tools. Adding native PHP bindings enables PHP developers to:
The native C extension approach provides significantly better performance compared to FFI or subprocess alternatives.
Changes Made
Core Implementation
LpmTableclass for IPv4 and IPv6Features
Build System
config.m4,configure.ac)package.xml)Documentation
Testing
.phptformatInfrastructure
.gitignorefor build artifacts and generated filesDockerfile.phpfor containerized testingTesting
Test Environment
Tests Performed
.phpttests intests/directory)Test Output
Performance Impact
Performance Notes
The PHP extension provides near-native C performance for PHP applications:
Documentation
Code Quality
Breaking Changes
This is a new feature addition with no breaking changes to existing functionality.
Additional Notes
Installation Methods
Via PECL (when published):
Manual Installation:
cd bindings/php phpize ./configure --with-liblpm=/path/to/liblpm make sudo make installEnable Extension:
Add to
php.ini:extension=liblpm.soExample Usage
Object-Oriented API:
Procedural API:
Package Distribution
The extension is ready for PECL publication with:
package.xmlmetadataChecklist
Reviewer Notes
Areas for Review
Memory Management: Please verify that all PHP object lifecycle management is correct, especially:
LpmTable::__destruct()PHP API Design: Feedback welcome on:
Build System: The extension integrates with both:
PECL Packaging: Review
package.xmlfor:Testing: Additional test scenarios welcome, especially:
Known Limitations
config.w32but untested)Future Enhancements