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

Crypto Types Laravel Package

sop/crypto-types

Strongly typed cryptocurrency value objects and Eloquent casts for Laravel. Store, convert, and compare Bitcoin, satoshi, and fiat amounts safely with immutable types that avoid floating-point rounding errors in your models and domain code.

Deep Wiki
Context7

Product Decisions This Supports

  • Build vs. buy on cryptographic plumbing. This package answers a narrow but recurring question: do we hand-roll DER/ASN.1 encoding, or do we take a dependency? For any feature that has to interoperate with non-PHP systems (JWTs, X.509 certs, PKCS#8 keys, ECDSA signatures), hand-rolling is the wrong answer. The package is the "buy" — small, MIT, focused.
  • Key-format interoperability on the roadmap. If the product needs to accept or emit keys in more than one shape — PEM ↔ DER ↔ JWK, PKCS#1 vs. PKCS#8 vs. SEC1, SubjectPublicKeyInfo wrappers — this library provides the typed structures to do that conversion safely. That is a real product requirement behind SSO, WebAuthn/passkey enrollment, signed license keys, mutual TLS, and "bring your own key" enterprise features.
  • Signature-format normalization. ECDSA signatures arrive as raw r||s from some platforms (Android Keystore, WebAuthn authenticators) and as DER SEQUENCE from others. Supporting both is a library problem, not a product problem — this is the kind of thing that silently blocks an integration late in a release.
  • Risk posture / "no custom crypto" policy. Adopting a typed ASN.1 library is a defensible answer to a security review asking why we're doing byte manipulation near private keys. It gives you a clean "we don't implement parsing ourselves" statement.
  • Dependency standardization. In practice this package's biggest product role is as a transitive dependency of the web-token/JWT Framework ecosystem. The decision it actually informs is "do we standardize our token/crypto stack on that family of libraries," not "do we install this directly."
  • Not a differentiator. There is no user-visible feature here, no config, no service provider, no migrations. It earns its place by de-risking, not by delighting.

When to Consider This Package

Adopt (directly or knowingly as a transitive dependency) when:

  • You are implementing or maintaining JWT/JWS/JWE/JWK, X.509, PKCS#7/PKCS#10, WebAuthn, or signed-artifact verification, and need to build or parse the underlying ASN.1 structures.
  • You need key or signature format conversion at an integration boundary with a third party, HSM, mobile client, or another language's crypto stack.
  • You are already on the web-token / sop/* family and this comes along for free — in that case the decision is "accept it," and the diligence is just version pinning.
  • You want a framework-agnostic, PSR-4, zero-integration library — it drops into Laravel with no wiring at all.

Look elsewhere when:

  • You only need hashing, symmetric encryption, or password hashing — use Laravel's Crypt/Hash or libsodium. This package does nothing for you.
  • You need high-level key management (loading, generating, rotating, storing JWKs). Reach for web-token/jwt-library, lcobucci/jwt, or firebase/php-jwt instead; this is a layer beneath those.
  • You need X.509 issuance/validation or a full PKI story — that's sop/x509 or a real PKI/CA service, not this.
  • Community size and maintenance depth matter more than API fit. 11 stars is a genuine signal: this is effectively single-maintainer infrastructure. If you must own the code path directly, phpseclib has far broader adoption, its own ASN.1 handling, and a much larger support base. Prefer this package as a transitive dep rather than a direct one you're betting on.
  • Metadata is thin. The repository is listed as unknown, which is itself a supply-chain diligence item — before any direct adoption, confirm the canonical repo, release cadence, and who has commit rights.
  • You'd have to touch it from application code. If a product feature would import Sop\CryptoTypes\* classes directly, that's a smell — wrap it.

How to Pitch It (Stakeholders)

For executives (one paragraph): This is not a feature; it's plumbing that lets us interoperate safely with other systems' cryptography without writing our own parsers. MIT-licensed, no cost, no vendor lock-in, negligible footprint. The reason to care is risk and speed: format-mismatch bugs near private keys are expensive, late-breaking, and security-sensitive, and this removes a class of them. The reason not to over-invest: it's a small, low-community library, so we should consume it through a well-maintained higher-level stack (the JWT Framework family) and keep it pinned and wrapped, not build product surface on it.

For engineering: Typed classes for AlgorithmIdentifier, SubjectPublicKeyInfo, RSAPublicKey, PrivateKeyInfo, and ECDSA signature structures — DER in, objects out, and back. It replaces ad-hoc base64_decode + substr key surgery with something reviewable. Zero Laravel integration cost: no provider, no config, no migrations. Two asks: (1) pin the version and treat upgrades as a security-relevant change, (2) put an internal KeyConverter/SignatureFormat interface in front of it so we can swap to phpseclib if maintenance stalls. If the requirement is genuinely just "sign and verify a token," prefer a higher-level library and let this arrive as a transitive dependency rather than a direct one.

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.
coleus/frame
thtg88/journalism
filagora/filagora-ai-forums
rlacerda83/query-parser
socialdept/atp-orm
cboxdk/laravel-assistant-client
socialdept/atp-resolver
socialdept/tenant-domains
tautvydasr/blade-class-names
socialdept/color-scales
maherelgamil/controller
coleus/widgets
coleus/table
coleus/users
coleus/music
coleus/health
coleus/calendar
coleus/notes
coleus/support
coleus/settings