whitehat101/apr1-md5
A small PHP implementation of the Apache APR1-MD5 password hash for generating and verifying htpasswd-compatible credentials. Offers simple hashing and checking APIs without external extensions, making it easy to integrate into Laravel or legacy PHP projects.
$apr1$ hashes from Apache .htpasswd / Basic Auth. The product decision it supports is “migrate authentication into the app with zero user-facing disruption,” which is usually a retention and support-cost win rather than a feature.password_hash()/Argon2id → retire the legacy path on a sunset date. It should appear on the roadmap as a bounded migration workstream with an exit criterion (legacy cohort hits zero, or a date passes), never as an ongoing capability.htpasswd.” Vendoring the source behind one interface is the recommended product stance: it removes supply-chain/abandonment risk while preserving byte-exact Apache compatibility that's easy to get subtly wrong..htpasswd users into a users table; a compatibility layer for internal tools still emitting $apr1$; verifying hashes in a mixed-auth environment during phased cutover; generating real Apache-compatible hashes as test fixtures.Consider it when all of the following hold:
$apr1$ hashes you must validate or reproduce with byte-exact Apache/htpasswd fidelity (salt and iteration quirks make naive reimplementation risky). You don't control the source of those hashes — Apache, an internal tool, or a system you're replacing.ext-apache, no shelling out to htpasswd, and no system binaries — i.e., it must run in a constrained container or serverless runtime.Hash).LegacyApr1Verifier contract, assign an owner, and record an exit criterion. Treat the low health signals — 34 stars, 0 dependents, single-maintainer, low activity — as explicit risk-acceptance items, not disqualifiers, for a temporarily-lived dependency.Look elsewhere — or don't adopt at all — when:
password_hash() (bcrypt/Argon2id). No package should change this, and this one shouldn't appear in any registration or reset flow.$2y$ bcrypt, $5$/$6$ SHA-crypt, or {SSHA}. This is APR1-MD5 specifically; don't stretch it. (Also note .htpasswd files are not exclusively APR1 — they can contain plaintext, {SHA}, and bcrypt, so inventory the actual formats before committing.)$apr1$ hashes at rest indefinitely.To executives (1–2 sentences): This is a small, MIT-licensed compatibility library that lets us read and migrate the password credentials our Apache/.htpasswd setup already produces, so we can move authentication into the Laravel application without forcing every user to reset their password. It's low-cost, low-blast-radius glue on a clearly bounded migration path — not a new platform dependency — and we recommend vendoring the code so we're not exposed if the upstream project goes quiet.
To engineering (the real case): It's a pure-PHP implementation of Apache's APR1-MD5, the $apr1$ hash behind htpasswd -m and Basic Auth. Composer-installable, no extensions, MIT, and it solves exactly one problem — byte-compatible verification and generation of legacy hashes — without shelling out to htpasswd or requiring Apache on the box.
Because the package has zero dependents and minimal activity, the recommended integration is vendor-and-pin, not a floating dependency: copy the source in, wrap it behind a single LegacyApr1Verifier interface (or register it as a Hash::extend('apr1', …) driver so the rest of the app keeps using Hash::check()), and treat it as a one-way migration utility. The key integration hook is needsRehash() returning true for every $apr1$ hash — pair every successful legacy verification with an immediate Hash::make() re-hash and persist the upgrade, so the legacy dependency shrinks to zero as users log in. Add a sunset criterion to the ticket: when the migrated-user count hits target (or a date passes), delete the wrapper and the vendored code together. Keep it out of any path that creates new credentials — new passwords go through password_hash() from day one. Low ramp-up (~1–2 days for adapter plus fixture tests against real htpasswd -m output); the real effort is migration operations — a runbook for legacy login failures, rehash failures, and feature-flag rollback — proportional to the legacy user population.
How can I help you explore Laravel packages today?