Run the install.sh file to install the extension.
./install.shThis will automatically run through the below processes.
Run the below pre-install script to check if you have the Sparsehashmap Library installed, and install it if you don't.
./pre-install-check.sh or manually run through the steps
# Extract the bundled Sparsehashmap Package
tar -xvf sparsehash-sparsehash-2.0.4.tar.gz
# Change Directory to the uncompressed folder
cd sparsehash-sparsehash-2.0.4
# Configure and make the library
./configure && make
# Install the library
sudo make install# Configure the Extension
phpize && ./configure --enable-sparsehashmap
# Make and Install the extension
make && sudo make install
# Add the Sparsehashmap .ini File to the PHP INI directory
echo "extension=sparsehashmap.so" | tee -a $(php-config --ini-dir)/sparsehashmap.iniYou should now see sparsehashmap listed in your php modules command
php -m | grep sparsehashmap
Basic Usage of Class
// Create instance of Sparsehashmap
$sparsehashmap = new Sparsehashmap();
// Insert into Sparsehashmap
$sparsehashmap->insert("key", "value");
// Check Key exists
$sparsehashmap->exists("key");
// Read the value of Key
$sparsehashmap->read("key");
// Remove Key/Value from Sparsehashmap
$sparsehashmap->remove("key")
// Check the size of Sparsehashmap
$sparsehashmap->length();
// Remove all data from Sparsehashmap
$sparsehashmap->flush();
// Get Sparsehashmap as array
$array = $sparsehashmap->to_array();See php_tests/test.php for a simple usage example.