- How do I install byrokrat/id in a Laravel application?
- Install it with Composer using composer require byrokrat/id. Because the package is a framework-agnostic PHP library, it does not ship Laravel service providers or bindings, so register your own adapter or value-object factory in a service provider if you need container resolution.
- Does byrokrat/id work with Laravel validation rules and form requests?
- The byrokrat/id package is not a Laravel validation package and does not provide Laravel rule classes out of the box. Wrap its parsing or checksum methods in a custom Rule class or Form Request, then return your own validation messages.
- Which Laravel and PHP versions are supported by byrokrat/id?
- The provided context does not list supported Laravel versions, and the package is a framework-agnostic PHP library rather than a Laravel integration. Check its Composer constraints and run a compatibility test on your Laravel runtime, especially if you are on PHP 8.2 or newer.
- How do I validate Swedish personal identity numbers with byrokrat/id?
- Use the package's value objects to parse a Swedish personal identity number and handle invalid input through its validation or exception behavior. In Laravel, perform that parsing inside a custom validation rule or Form Request and normalize the input before checking it.
- Can byrokrat/id validate Swedish organization numbers and coordination numbers?
- Yes, the package overview explicitly covers personal identity numbers, coordination numbers, and organization numbers. Add fixture tests for the exact organization-number and coordination-number formats your application accepts, because those edge cases are where correctness risk concentrates.
- How does byrokrat/id handle checksum verification and birth dates?
- The package advertises checksum verification and birth date handling for Swedish identity numbers, and the overview mentions age calculation. Verify century-boundary, temporary-ID, and regulatory edge cases with your own test fixtures before relying on the behavior.
- Is byrokrat/id safe to use in production for onboarding or KYC?
- Treat it as a low-risk computational dependency but a higher-risk maintenance dependency because repository metadata and maintenance signals are unclear. For onboarding or KYC, pin the version, wrap it behind an application-owned adapter, and add characterization tests for valid and invalid Swedish IDs before relying on it.
- How should I integrate byrokrat/id with Eloquent casts and value objects?
- Create a custom Eloquent cast that maps the database string to your own PersonalIdentity or CorporationIdentity value object and delegates parsing to byrokrat/id. Keep the package behind that adapter instead of exposing its classes throughout your domain so replacement remains cheap.
- Is byrokrat/id actively maintained, and what are the alternatives?
- The assessment flags low stars, unknown repository metadata, and no obvious maintenance signal, so long-term support is the dominant risk. Alternatives include maintaining a fork, implementing the checksum validation internally, or evaluating other Swedish identity-number libraries after confirming PHP and Laravel compatibility.
- How do I test Swedish identity number validation in Laravel?
- Build a fixture set of representative valid and invalid personal identity, coordination, and organization numbers and assert your adapter's parse, validate, and format behavior. Because there are no Laravel-specific bindings, test through your custom validation rule and Eloquent cast rather than expecting package-level framework tests.