verbanent/eloquent-binary-uuid
Store UUID primary keys as compact 16-byte binary values instead of 36-character strings. This Laravel/Eloquent package provides casts and model traits for efficient binary UUIDs, reducing storage and improving index performance.
creating hook cannot encode (neither a UUID string nor 16 raw bytes) now throw instead of being written and silently truncated by MySQL when strict mode is off. Supports decisions where silent corruption is an unacceptable failure mode.$uuidColumn / binary-uuid.default_column), plus a new README Troubleshooting section. This directly reduces the time a new engineer spends debugging a misconfigured UUID column — a recurring cost in any project using the package.TypeError fix indicates a maintenance-minded package. Relevant if you are deciding whether to commit to it as a long-term dependency versus an unmaintained alternative.BINARY(16) UUIDs, foreign key columns built via foreignUuid(), throughput- or storage-sensitive tables where a 36-byte CHAR key is too expensive, and teams that want automatic ID assignment without writing observers.Adopt when:
BINARY(16) rather than CHAR(36) for storage and index efficiency on MySQL.$uuidColumn, binary-uuid.default_column) instead of per-model glue.Look elsewhere when:
uuid column types or a string-UUID package are simpler.Executives: this is a small, low-risk maintenance upgrade to an internal dependency with no API changes. The substance is error quality and one safety guardrail: previously, a misconfigured UUID column could accept a bad value and let MySQL truncate it silently — a data-integrity failure that tends to surface months later during reconciliation. That path now fails immediately with a message naming the model and column. Net effect is lower incident risk and lower support burden, at effectively zero migration cost for correctly configured models.
Engineering: v1.11.0 replaces opaque ramsey/uuid failures ($bytes string should contain 16 characters.) with a package-owned InvalidBinaryUuidException thrown from uuid() and foreignUuid(), naming the model, the column, the observed byte length, and the specific setting to change. UUIDs stored in string form are called out as a distinct, more actionable case. The creating hook now rejects values it cannot encode instead of passing them through — the only behavioural change, and it only affects inserts that were already storing wrong data. Also fixes a latent TypeError where non-string values reached Uuid::isValid(). Upgrade is a drop-in; audit any code path that assigns non-UUID values to the UUID attribute before deploying.
How can I help you explore Laravel packages today?