Skip to content
CAI
Software that uses CAICheck a score

vinkla/hashids

67.9

Adequate · 19 September 2026

428

lines of production code

PHP

primary language

1

measurement over time

CAI band scale
CAI lens gauges

What this system is

This system is the Hashids library, a PHP tool designed to encode and decode numeric IDs into short, unique strings using customizable alphabets and salts. It supports arbitrary-precision arithmetic for handling large integers by leveraging either the BCMath or GMP extensions. The codebase enforces modern PHP 8+ standards with strict typing and provides comprehensive test coverage for its core encoding logic and mathematical backends.

Removals

Removal of legacy hash-ids library files

The \lib/hash-ids.php\ and \lib/hash\_ids.php-5-3.php\ files, which contained the \hash\_ids\ class for encoding and decoding numeric IDs using a custom alphabet and salt, have been deleted from the library. This removes the legacy implementation of the hash-ids functionality (version 0.1.0) from the codebase.

lib · high confidence

Behavioural changes

Introduction of separate BCMath and Gmp math implementations

The library now provides distinct math backend classes (BCMath and Gmp) that implement the new MathInterface, allowing users to choose between the BCMath or Gmp PHP extensions for arbitrary-precision arithmetic operations such as addition, multiplication, division, and modulo.

src/Math · high confidence

Repository configuration and documentation overhaul

This change introduces standard repository configuration files including .editorconfig for consistent coding styles, .gitattributes to manage line endings and export ignores, and a simplified .gitignore. It also adds a dedicated CHANGELOG.md file to track version history separately from the README. The LICENSE file has been updated to the standard MIT format, and the README.md has been significantly rewritten to reflect the current library structure, usage examples, and a note regarding the project's successor, Sqids.

(repo-wide) · high confidence

Version 5.0 release with PHP 8+ typing and arbitrary-precision math support

This release introduces Hashids version 5.0, requiring PHP 8+ and enforcing the use of the BC Math or GMP extensions for handling arbitrary-length integers. The library now uses strict PHP 8 type declarations, camelCase method names, and UTF-8 support for alphabets and salts. The API surface has been updated with new helper classes for math operations and a restructured namespace, while maintaining backward compatibility for the core encode/decode functionality.

src · high confidence

Test coverage

Added unit tests for Hashids encoding and math backend implementations

Added new test suites in \tests/HashidsTest.php\ and \tests/MathTest.php\ to verify the Hashids library's core functionality. The Hashids tests cover input validation (e.g., invalid alphabets, bad inputs), encoding/decoding with various salts, minimum lengths, and different parameter types. The Math tests ensure that both GMP and BCMath extensions are correctly utilized for arithmetic operations like addition, multiplication, division, and comparison, running tests for whichever extension is available.

tests · high confidence

Dependencies

Update to Hashids 5.0 with PHP 8.1+ requirement

The package has been updated to version 5.0, which now requires PHP 8.1 or higher and uses PSR-4 autoloading with the source code moved to the 'src/' directory. The development dependency on PHPUnit has been updated to support versions 10.5, 11.2, and 12.0, while the library itself suggests the bcmath or gmp extensions for arbitrary precision mathematics.

(dependencies) · high confidence

Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

How this codebase got here

Baseline

  • First survey — no prior run to compare against. CAI 68.

Lenses

  • Code Health 100
  • Architecture 69
  • Maturity 59
  • Readiness 72
  • Security 92

Changes since last survey

  • 300 commits — 287 feature/other, 13 fixes

By area

  • (root) — 141 commits
  • src/Hashids.php — 51 commits
  • (repo) — 33 commits
  • .github/workflows — 33 commits
  • tests/HashidsTest.php — 10 commits
  • lib/Hashids — 8 commits
  • src/Math — 5 commits
  • tests/MathTest.php — 5 commits
  • src/HashGenerator.php — 3 commits
  • src/Math.php — 2 commits
  • src/Support — 2 commits
  • tests/MathInterfaceTest.php — 2 commits
  • .github/dependabot.yml — 1 commit
  • examples/encoding_decoding_several_numbers.php — 1 commit
  • examples/encoding_several_numbers.php — 1 commit
  • src/HashidsInterface.php — 1 commit
  • tests/AbstractTestCase.php — 1 commit

Notable commits

  • fix: Coding standard fix
  • fix: Coding standards fix
  • fix: Fix PHPDoc of multiByteSplit
  • fix: Fix PSR12 syntax
  • fix: Fix docbloc
  • fix: Fix the data provider to test both Gmp and BCMath when both extensions are installed (#189)
  • fix: Fixed broken image
  • fix: Merge pull request #79 from jkramarz/hotfix/bcmath-scale
  • fix: fix broken logo url
  • fix: fix phpdoc types for encode method (#188)
  • fix: fix: add --no-interaction flag to php-cs-fixer command
  • fix: fix: update package links
  • fix: logo fix
  • change: 1.0.2 cleanup
  • change: :arrow_up: phpunit/phpunit
  • change: :up:
  • change: Add * text=auto to .gitattributes
  • change: Add .codecov.yml file
  • change: Add .editorconfig file
  • change: Add PHP 7.0 support
  • …and 280 more

Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

Survey your own repository

vinkla/hashids was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.

About this page

  • The score is its most recent published measurement, taken on 19 September 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
  • Measured at commit 5f18db11ab23a7661a5333d91a5ec1aa62735a61 — the exact code this score is about.
  • Scored under rubric-2026.09.15 — the same rubric and the same method as every other entry in this index.
  • Measured by watchdog.canine.dev using codehealth-analyzer preprod-13a154b7f5d1.