iconify/json-tools
PHP utilities for working with Iconify JSON icon sets: parse and validate icon data, look up icons and metadata, optimize collections, and generate custom subsets for lightweight SVG icon bundles and build pipelines.
Architecture fit. iconify/json-tools is a headless, framework-agnostic utility library: no service provider, no config, no facades, no HTTP layer. It operates on the Iconify JSON collection format (a JSON document containing icon names, SVG bodies, width/height, aliases, and metadata) and provides classes for parsing, validating, filtering, merging, and emitting those collections, plus SVG manipulation helpers for path simplification and cleanup. In a Laravel context this makes it a domain library, not infrastructure — it belongs behind an application service or a queued job, invoked from whatever pipeline owns icon assets. It fits cleanly if the product requirement is server-side icon set management (tenant-specific icon subsets, an admin icon picker that writes custom collections, a CMS that serves branded icon bundles). It is a poor fit if the only requirement is bundling icons into the frontend — that problem is already solved at build time by the Node tooling (@iconify/tools, unplugin-icons, the Vite pipeline), and reimplementing it in PHP adds a runtime dependency for zero user-visible benefit.
Integration feasibility. Composer-only install under the Iconify\JSONTools namespace; no Laravel version constraints to conflict with, no global state, PSR-4 autoloading. A competent Laravel developer can have a proof of concept parsing a downloaded collection, filtering to a whitelist, and emitting a valid subset in under a day. The real integration cost is not the library — it is the data supply chain: you must source collection JSON yourself (the iconify/json dataset is distributed via npm/GitHub and is hundreds of megabytes across all sets), decide where it lives (S3, a build artifact, a scheduled sync), and handle versioning of that data separately from the package version.
Technical risk. Ranked:
json_decode into associative arrays is memory-hungry; large collections decode into tens of megabytes of PHP arrays, and SVG path optimization is meaningfully slower than the equivalent Node/SVGO pipeline. This must never run in a request cycle against a large set.Key questions. Is the icon requirement server-driven or build-time? Who owns the icon dataset sync, and how stale may subsets be? What is the maximum collection size we will process, and what is the worker's memory_limit? Do we need to preserve aliases/metadata round-trip, or only render output? Is there a compliance owner for per-set icon licensing and attribution?
Stack fit. High compatibility, low coupling. Works on any PHP 7.4+/8.x runtime Laravel supports, no extensions beyond standard JSON, no conflicting dependency tree. It does not integrate with Laravel's cache, queue, storage, or HTTP abstractions — deliberately — so the adapter layer is yours to write.
Migration path. There is nothing to migrate from; this is greenfield adoption. The realistic paths are:
Recommend path 3 only if multi-tenancy is a real near-term requirement; otherwise path 2 and skip the dependency entirely. If path 1 or 3 is chosen, treat the package as a swappable adapter: define an IconCollectionBuilder interface in the app, implement it once against this library, and keep the rest of the codebase ignorant of Iconify\JSONTools.
Compatibility. No framework-version coupling; the meaningful compatibility axis is the Iconify JSON schema version and the PHP memory configuration of the workers. Pin the package to an exact version in composer.json, mirror it in an internal fork or a vcs repository entry, and add a smoke test that parses a known collection and asserts icon count, alias resolution, and output validity — that test is your early warning for schema drift on upgrade.
Sequencing.
Maintenance. Low code churn but low community scrutiny — allocate a named internal owner rather than assuming upstream responsiveness. Realistic budget: a few hours per quarter for dependency review and contract-test verification, plus a fork contingency (one to three days to internalize the source if upstream stalls; the library is small enough that this is credible). Add a Renovate/Dependabot entry and a documented fork procedure.
Support. No vendor, no SLA, issues via GitHub. Escalation is "read the source" or "fork it." That is acceptable for a utility library but must be stated explicitly, because it shifts debugging burden onto your team — particularly for SVG edge cases (unusual path data, missing viewBox, non-standard width/height) where behavior will be whatever the library does.
Scaling. Scales horizontally by running subsets in dedicated queue workers, not by adding web capacity. Cost drivers: decode memory per worker (size your worker count against collection size, not request volume), CPU for SVG optimization, and storage for generated subsets. Subsets are highly cacheable and content-addressable — key them by a hash of (source version, icon allowlist, options) and the steady-state compute cost approaches zero. Avoid re-subsetting the same combination on every request; that is the failure mode that turns a cheap job into a self-inflicted DoS.
Failure modes. Memory exhaustion on large collections (silent 500s in a worker); malformed or unusual SVG producing a valid-looking but visually broken icon — requires visual regression or hash-based output diffing; dropped aliases or metadata breaking frontend consumers that rely on them; stale source data producing missing icons that fail silently rather than loudly; unbounded output growth if an allowlist filter is misconfigured. Mitigate with hard memory_limit and max_execution_time per job, a validation step asserting the emitted collection is loadable and non-empty, alerting on icon-count deltas beyond a threshold, and a strict allowlist rather than a denylist.
Ramp-up. The API is small enough to learn in a day, but productive use requires familiarity with the Iconify JSON schema itself — aliases, metadata, and optimization semantics are where the real learning curve lives. Budget one senior developer for a week to reach confident ownership, and require them to write an internal one-pager covering schema conventions, the sync job, and the fork procedure. Frontend and design stakeholders need only the output contract (where subsets live, how they're versioned), which is a one-hour briefing.
How can I help you explore Laravel packages today?