Nichlas Severinsen 00f8f666d0 Updated CHANGELOG.md | il y a 4 ans | |
---|---|---|
include | il y a 5 ans | |
src | il y a 5 ans | |
tests | il y a 5 ans | |
.editorconfig | il y a 5 ans | |
.gitignore | il y a 5 ans | |
.php_cs | il y a 5 ans | |
CHANGELOG.md | il y a 4 ans | |
COPYING | il y a 5 ans | |
LICENSE.txt | il y a 5 ans | |
README.md | il y a 5 ans | |
composer.json | il y a 5 ans | |
phpunit.xml | il y a 5 ans |
This is an FFI binding of the libxxHash
library from xxHash for PHP.
You're here because:
xxhash
package on your system to get libxxHash.If so, you're in the right place.
You will obviously need the xxHash
package.
In addition you will need libffi
, and enable FFI for PHP (You will therefore need PHP version 7.4 or above).
libxxhash needs to be v0.6.4 or above.
Here are some common ways to install:
sudo pacman -S xxhash libffi
sudo apt install xxhash libffi
sudo dnf install xxhash libffi
sudo zypper install xxhash libffi
PHP has to be compiled with the --with-ffi
option, most distributions will have done this.
Locate the relevant php.ini
file on your system and make sure these two lines are present, uncommented:
extension=ffi
ffi.enable=true
Then, simply add the bindings to your project:
composer require necklace/xxhash-ffi
Alright, alright. I know what you want, and I got what you need. You've got files, we got hashes:
<?php
use Necklace\XxHash\XxHash64;
$xxh = new XxHash64;
echo $xxh->hashFile('filename');
cee0f97cde3a4cda
This library supports the XXH3 algorithm, you can use this but beware; it's still labeled experimental : return values from this version are not comparable with other versions.
<?php
use Necklace\XxHash\Xxh3\XxHash64;
$xxh = new XxHash64;
echo $xxh->hashFile('filename');
db70939c6397e562
Look in tests/
for more examples.
This repository and all its files is under the same license as the xxHash project; the BSD 2-Clause License.
See COPYING or LICENSE.txt.
Clone and run composer install
.
Remember to run ~/.config/composer/vendor/bin/php-cs-fixer fix src/
Run all tests with php vendor/bin/phpunit
from the top directory.
Test memory leaks in tests with vendor/bin/roave-no-leaks
.