A high-performance PHP extension for compressed bitmap operations, powered by Rust's roaring-rs and phper.
- Blazing fast bitmap set operations: union, intersection, difference, symmetric difference
- Efficient storage and querying of large sets of integers
- Easy-to-use PHP OOP API
- Full test coverage (Rust + PHP)
- PHP 7.4+ (with php-dev, phpize, etc)
- Rust (nightly or stable)
- Linux/macOS (Windows not officially supported)
cargo build --releaseCopy the compiled extension to your PHP extension dir:
cp target/release/libroaring_bitmap.so $(php-config --extension-dir)Add to your php.ini:
extension=libroaring_bitmap.so
Rust unit tests:
cargo test --releasePHP functional tests:
php -d "extension=target/release/libphp_roaring_bitmap.so" test.php$rbm = new RoaringBitmap();
$rbm->insert(1);
$rbm->insert(2);
$rbm->insert(3);
echo $rbm->count(); // 3insert(int $value): boolcontains(int $value): boolremove(int $value): boolcount(): intisEmpty(): boolmin(): ?intmax(): ?intunion(RoaringBitmap $other): voidintersect(RoaringBitmap $other): voiddifference(RoaringBitmap $other): voidsymmetricDifference(RoaringBitmap $other): voidisSubset(RoaringBitmap $other): boolisSuperset(RoaringBitmap $other): boolisDisjoint(RoaringBitmap $other): bool
MIT