oskarstark/trimmed-non-empty-string
A tiny PHP value object that trims surrounding whitespace from strings and guarantees the result is non-empty, throwing an exception when validation fails. Use it to keep user input and domain values clean, predictable, and safe.
Assessment of release 1.11.2: This is a tooling-only patch. All four merged PRs are internal engineering hygiene — removal of a CI env flag, adoption of a shared ergebnis/php-cs-fixer-config ruleset, a test assertion style change (assertNotSame), and introduction of Rector with a fluent config builder. There are no public API changes, no behavioral changes, no deprecations, and no new features. Runtime risk from upgrading 1.11.1 → 1.11.2 is effectively zero.
Architecture fit: oskarstark/trimmed-non-empty-string is a framework-agnostic, single-purpose PHP value object library (a PSR-4 Composer package, not a Laravel package — no service provider, no config, no facade). It fits cleanly into a Laravel codebase as a domain primitive: DTOs, form-request-normalized input, console command arguments, queue payload construction, and anywhere the codebase currently does trim($x) === '' checks inline. It does not impose architectural opinions, which means it also does not enforce consistency — value only materializes if the team adopts it as a convention.
Integration feasibility: High. A single composer require with no publish/install step, no container bindings, and no migration. The only meaningful compatibility check is the package's require.php constraint; the 8.2 reference in the changelog applies to the upstream dev ruleset and should not be read as a raised runtime floor, but it is worth confirming against composer.json before pinning.
Technical risk: Low on code, moderate on governance. The library is small enough to audit in full in an afternoon, which caps worst-case risk — a fork or vendored copy is a realistic mitigation. The real considerations are bus factor (single primary maintainer, Oskar Stark), a 1.x version line with no stated LTS commitment, and the fact that a package this small delivers modest leverage relative to the supply-chain entry it adds.
Key questions:
php constraint, and does it match the oldest runtime in our fleet?Stringable/int-like inputs, or strictly string? This determines how much normalization we own.Cast wrapper, or is manual construction in DTOs sufficient?Stack fit: Drop-in for any PHP 8.x Laravel application. Because it is unopinionated, the integration work is entirely ours: decide the boundary (recommendation — Form Requests and DTO constructors in, Eloquent attribute casting optional), and document it so the object does not become a third way of representing strings alongside string and nullable strings.
Migration path: No migration is required by 1.11.2. Adoption is opportunistic rather than a project: introduce the type in new code first, and convert existing ad-hoc trim/empty validation only where tests already cover the behavior. Avoid a sweeping refactor — the value is in consistency, and a half-migrated codebase delivers none.
Compatibility: SemVer 1.x is being respected; 1.11.2 is a patch with no autoload or signature changes. Pin as ^1.11 and let Composer float patches — the CI churn visible here (PHP-CS-Fixer config consolidation, Rector adoption) is a positive signal that the maintainer keeps the toolchain current, which historically correlates with faster PHP-version compatibility for consumers.
Sequencing: (1) Confirm PHP constraint and read the class source (~1 file). (2) Add the dependency and a single pilot usage behind existing tests. (3) If the pilot holds, add a short internal convention note plus, if warranted, a thin Eloquent cast. (4) Mirror upstream's static-analysis posture — they now run Rector and a shared CS ruleset; ensure our own PHPStan/Rector config does not diverge in ways that make future upgrades noisy. (5) Track upstream releases on a quarterly cadence rather than per-release, since patch releases here are CI-only by nature.
Maintenance: Negligible runtime maintenance; the changelog indicates the maintenance effort is spent on development tooling. Expect continued low-signal patch releases of this shape. Practical implication: do not treat every 1.11.x as a review event — batch them into routine dependency updates, and reserve real review for minor-version bumps where a new public method might appear.
Support: Community OSS with no SLA and a single primary maintainer. Acceptable for a leaf-node utility; not acceptable if it silently becomes load-bearing across dozens of DTOs without anyone else on the team able to read the implementation. Cheap de-risking: keep the usage surface small and centralized (a factory or cast), so replacing it with an in-house equivalent is a one-file change.
Scaling: Irrelevant as a bottleneck. Immutable value objects, no I/O, no caches, no global state. Allocation cost is within noise compared to framework request overhead. No serialization concerns beyond ensuring the object is reconstructible in queue payloads — if it is not JsonSerializable, jobs must carry the plain string and hydrate on the consumer side.
Failure modes:
Ramp-up: Minutes for a developer who has used a value object before. The cost is not learning the API but agreeing on where it belongs in the codebase. Budget a short written convention (one paragraph plus a code example) alongside the dependency, otherwise the package adds a dependency without buying the invariant it exists to provide.
How can I help you explore Laravel packages today?