ozdemirburak/iris
PHP color library for manipulation and conversion between Hex, Hexa, RGB, RGBA, HSL, HSLA, HSV, CMYK, and OKLCH. Requires PHP 8.1+ and supports named colors, alpha channels, and conversion methods.
Architecture fit. Despite being framed as a Laravel/PHP package, Iris is a framework-agnostic, PSR-4 PHP library with no service provider, facade, config, or Laravel coupling. That is a fit advantage, not a gap: it drops into any Laravel service layer via composer require and imposes zero bootstrapping. The natural seams are theme/design-token services, a custom HexColor validation rule, API resources that emit CSS color strings, and Blade helpers. It should live behind a thin internal adapter (e.g., ColorService contract) rather than being called directly from controllers, so the vendor choice stays reversible.
Integration feasibility. High and low-ceremony. Pure value objects with to*() conversions and values() accessors map cleanly onto DTO/assembler patterns. The Factory::init() entry point is useful for untrusted input from DB rows or form fields, but it belongs behind our validation boundary, not in place of it. The gradient API (added late 2025) is the most product-relevant capability for generating scales, hover states, and chart palettes without a design-tool round trip.
Technical risk. Moderate but bounded. 124 stars and 0 dependents means low community gravity — small blast radius if it breaks, but also little collective debugging knowledge. Single-maintainer bus factor is the primary structural risk. The API surface is stable across a long changelog, but recent breaking changes (PHP 8.1 minimum, PHPUnit 10/11) show the project is willing to raise floors. Known behavioral sharp edges: OKLCH silently ignores alpha (data-loss risk if we assume round-trip fidelity), alpha handling and CMYK rounding were corrected recently (verify version), and conversion paths are not guaranteed lossless. Exception behavior for malformed colors isn't documented in the README — confirm empirically before designing error handling. Release metadata looks inconsistent (a 2026 release date alongside a 2025-12 changelog entry), so pin against verified Packagist tags rather than dates.
Key questions.
isLight()/isDark() but no contrast-ratio API — we'd build it ourselves or add a second library.Stack fit. Laravel 9+ on PHP 8.1/8.2/8.3/8.4. Composer-only install, no publishable assets. Use it in: (1) a ColorService/ThemeRepository in the domain layer, (2) a ValidHexColor (and variant) validation rule, (3) API resources serializing tokens, (4) artisan commands or jobs that precompute palette tables. Avoid Blade-side conversion logic; compute once, cache, render strings.
Migration path. Start from wherever color math currently lives — inline hex arithmetic, CSS preprocessor functions, or a homegrown helper. Sequence: wrap Iris behind our own interface first, port call sites to the interface, then delete the legacy helpers. If another library is in place, the adapter makes the swap a single-file change. Importing existing palettes is a data migration, not a code migration: validate all stored values through the Factory and log rejects rather than throwing mid-deploy.
Compatibility. No Laravel version constraints, so no conflict with framework upgrades. No stated runtime dependencies beyond PHP, which keeps the dependency graph clean. On PHP 8.0 or older, Composer will resolve to a pre-2025 tag — acceptable but means forgoing OKLCH, clone(), and gradients. Namespace collisions are unlikely (OzdemirBurak\Iris). Pin with ^ and let Renovate/Dependabot surface breakage; the major-version bumps should be treated as potentially breaking despite semver.
Sequencing. (1) Spike: one feature, e.g., generate a 9-step brand palette with gradient() and lighten()/darken(). (2) Adapter + unit tests covering every format we emit and the malformed-input path. (3) Validation rule at the input boundary. (4) Expand to tint/shade/mix for component states. (5) Evaluate OKLCH for perceptual scaling only after confirming the alpha limitation is acceptable. (6) Document conventions and add a palette snapshot test to catch upstream conversion drift.
Maintenance. MIT, no license friction. Single maintainer with a long but bursty release history — expect quiet periods punctuated by breaking bumps. Low dependency surface means low supply-chain exposure. Budget a small recurring effort: watch releases, re-run snapshot tests, and keep the adapter thin enough that a fork (vendoring the classes) is a half-day exercise if upstream goes dark.
Support. GitHub issues only; no commercial backing, no SLA. With 0 dependents there is no Stack Overflow corpus to lean on, so internal documentation substitutes for community knowledge. Escalate design questions to the owning team, not upstream.
Scaling. Effectively free at runtime — pure, deterministic, CPU-bound string math with no I/O. It scales to request volume without thought. Two caveats: gradients with large step counts allocate proportionally larger arrays (compute at build/deploy time for token tables, not per request), and repeated conversions of the same values should be cached in the service layer.
Failure modes.
composer update pulling a PHP 8.1+ tag into a legacy app and breaking CI.Ramp-up. Very low. The API deliberately mirrors CSS color function syntax, and the README is example-dense across every format and mutation. A Laravel developer with CSS familiarity is productive in under a day; the real ramp is organizational — agreeing where color logic lives and which formats are canonical. Given the score, 124 stars, and zero dependents, treat Iris as a convenient, replaceable utility rather than foundational infrastructure: adopt it, wrap it, don't build the design system's identity around it.
How can I help you explore Laravel packages today?