- What is reducktion/socrates used for?
- Socrates is a PHP 8.1+ package for validating and extracting information from national identification numbers. It exposes person-identity primitives such as Gender and Country enums plus per-country ID validators and extractors. It is a domain/data-validation library, not a Laravel-native extension point.
- Does reducktion/socrates work with Laravel?
- Yes, but not as a Laravel-native package after v2.0.0. It is explicitly framework-agnostic, so you consume it as a Composer dependency in your domain layer and own the Laravel integration. That means adding a service provider binding, a custom validation rule, enum casts, and API serialization conventions in your app.
- How do I install reducktion/socrates?
- Install it with Composer on PHP 8.1 or newer: composer require reducktion/socrates. The v2 line removed Carbon, which shrinks the transitive dependency graph and reduces conflict risk with Laravel's constraints. There is no service provider auto-discovery to rely on after v2.0.0.
- Which Laravel versions does reducktion/socrates support?
- The package no longer carries an illuminate/* constraint after v2.0.0 because the Laravel glue was removed. It fits Laravel 9 and 10 comfortably on PHP 8.1+, while Laravel 11 requires PHP 8.2, so confirm your runtime floor before locking. Your app-owned adapter, not the package, determines the effective Laravel compatibility.
- How do I use Socrates with Laravel validation?
- Wrap the package's national ID validators in a custom Laravel validation rule owned by your application. Register the rule in a service provider or via your validation extensions, and keep the rule key stable for existing call sites. Because the built-in validation rule was removed in v2.0.0, missing a call site can silently leave PII-adjacent input unvalidated.
- What breaking changes are in Socrates v2.0.0?
- Version 2.0.0 removes the Laravel facade, the Laravel validation rule, the old string constants, the Luxembourg validator/extractor, and Carbon return types. It also drops Testbench and moves to PHPUnit 9 for package-level testing. Any code using those removed APIs will break at runtime or fail static analysis, so inventory and migrate call sites before upgrading.
- Is Luxembourg national ID support still available in Socrates?
- The TPM assessment says the Luxembourg validator/extractor was removed in v2.0.0. Confirm whether that support was intentionally dropped or relocated to a sibling package, and check whether your app currently depends on it. If you need Luxembourg coverage, pin 1.x or plan an in-house replacement.
- Are the Gender and Country enums backed in Socrates?
- The evaluation flags this as a key question: confirm whether Gender and Country are backed string or int enums and what the case values are. Backed versus pure enum behavior determines Eloquent cast behavior, database storage, JSON payloads, seeders, and API contract changes. Audit any code comparing against 'male' or 'LU'-style strings before migrating.
- Does Socrates handle PII safely in logs and exceptions?
- Socrates validates and extracts national ID data, which is PII-adjacent, but the package is narrow and the evaluation does not confirm any logging behavior. You must audit your adapter, exception handling, and validation error messages so raw national IDs are not written to logs or exposed in API responses. Keep PII handling in app-owned code where you can enforce redaction.
- What are alternatives to reducktion/socrates and how do I maintain it?
- Alternatives include Laravel's built-in validation rules for basic formats, broader validation libraries, or in-house national ID validators when coverage is small. For Socrates, check the repository for release cadence, maintainer bus factor, and a security disclosure path, and document a support window for the 1.x line. If you adopt v2, budget the Laravel adapter as first-class work rather than glue.