Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Murmurhash Laravel Package

lastguest/murmurhash

A fast, dependency-free PHP implementation of MurmurHash (MurmurHash3) for non-cryptographic hashing. Generate consistent 32/128-bit hashes for sharding, caching keys, bloom filters, and partitioning. Simple API, Composer-ready, and easy to drop into Laravel or any PHP project.

View on GitHub
Deep Wiki
Context7

lastguest/murmurhash is a pure-PHP implementation of MurmurHash, the fast non-cryptographic hash function designed for hash-based lookup. It lets PHP applications generate compact, deterministic hashes without requiring a C extension, making it easy to add consistent hashing to existing projects via Composer.

Use it for partitioning keys across shards, building hash tables, cache routing, Bloom filters, or any workload that needs speedy, seedable hashing. The API is simple and dependency-free.

  • Pure PHP implementation—no extensions or native builds
  • Fast MurmurHash3 hashing for strings and binary keys
  • Configurable seed for reproducible, isolated hash spaces
  • Composer-installable with PSR-4 autoloading
  • Suitable for sharding, caching, Bloom filters, and hash tables
Frequently asked questions about Murmurhash
How do I install lastguest/murmurhash in a Laravel application?
Run composer require lastguest/murmurhash and call the static hash method directly; there is no service provider, config file, or publish step. The package is framework-agnostic and has no illuminate/* constraints, so it installs cleanly alongside any Laravel version. Most teams wrap the static call behind a small in-house Hasher interface so the dependency stays swappable.
Does lastguest/murmurhash support Laravel 10 and Laravel 11?
Yes, but only in the sense that it never touches the framework at all. It is a single static class with no service provider, no container bindings, and no Laravel version constraints, so framework upgrades cannot conflict with it. Your real compatibility risk is the PHP runtime, not the Laravel release.
Is MurmurHash3 faster than xxh3 or crc32 in PHP?
No. This is a pure-PHP userland implementation doing byte-wise mixing with integer masking, which is roughly one to two orders of magnitude slower than native hash('xxh3') or crc32(). It is fine for per-request bucketing or hashing a handful of keys per job, but it is a poor fit for hashing every row of a large export or every event in a hot ingestion path.
Why use MurmurHash3 instead of md5 or sha256 for sharding?
MurmurHash3 is non-cryptographic with strong avalanche behavior and a fixed, cheap output, which is exactly what consistent-hash rings, shard keys, experiment buckets, and bloom filters need. md5 and sha256 work but are heavier and produce wider digests than those use cases require. The one legitimate reason to insist on Murmur3 specifically is cross-language parity with an existing pipeline.
Is lastguest/murmurhash maintained and safe for production?
The last release was April 2021 with a single maintainer and no reported dependents, so treat the maintenance horizon as already passed. It has no security surface at all: no deserialization, no network, no filesystem, no code execution beyond the algorithm, so it will never appear on a vulnerability report. That also means it will never appear on anyone's patch radar, so the correctness burden is yours.
How do I implement consistent A/B test bucketing with MurmurHash3 in Laravel?
Hash a stable key plus your experiment salt with a fixed seed, then take the result modulo the number of buckets to get a deterministic assignment. Because the output is uniform and seed-sensitive, the same user always lands in the same cohort across processes and deploys. Store the salt and seed in config so assignments stay reproducible for the life of the experiment.
Do I need a service provider to use lastguest/murmurhash with Laravel?
No, the package ships no service provider and needs none. You can call the static method anywhere, but the recommended pattern is to define an App\Support\Hashing\Hasher contract with a hash(string $input, int $seed = 0): int method and bind a Murmur3Hasher adapter in your own small provider. That costs about a day of work and turns an abandoned dependency into an implementation detail you can replace without touching domain code.
Can MurmurHash3 produce different results on 32-bit versus 64-bit PHP?
Yes, that is the serious risk with a userland implementation. Murmur3 depends on integer overflow and bit-masking behavior that has historically differed between 32-bit and 64-bit builds and has shifted across PHP minor versions. If the output feeds a persistent shard map or experiment assignment, a silent divergence re-buckets users with no exception and no alert, so pin golden-vector tests in CI.
What are the best alternatives to lastguest/murmurhash for fast hashing in PHP?
If you only need spread and speed, hash('xxh3') on PHP 8.1+ is native, far faster, and perfectly adequate; crc32() is even cheaper but has poor avalanche behavior. If you need cryptographic properties, sha256 is built in. Reach for this package only when an existing Java, ClickHouse, Spark, or Redis pipeline already buckets on Murmur3 and you must produce identical output.
How do I verify MurmurHash3 output matches other languages like Java or ClickHouse?
Build a golden-vector test suite from reference implementations in the downstream system and assert the PHP output matches byte for byte across seeds and input lengths. Run it on both 32-bit and 64-bit PHP builds and re-run it on every PHP upgrade, since integer overflow semantics are where divergence hides. Ownership of that suite should be explicit, because the package ships no tests that guarantee parity.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
shitoudev/permissionmanager
johannesclimacus/laravel-tui
hocvt/seotools
vitalybaev/sypexgeo
amphibee/themosis-ignition
gito-me/fast-excel
frankyso/laravel-ipaymu
geolize-studio/laravel-chile
boomerangui/chat
jinas/dhivatar
store-doc/laravel-storage-driver
plus-it/laravel-translation-manager
diephp/perhaps
diephp/telegraph
osmaviation/spreadsheet
microsoft/fluentui-system-icons
mmccook/php-json-canonicalization-scheme
middlewares/firewall
qubiqx/montapacking
nyoncode/laravel-package-console