markup/json
Markup JSON is a lightweight PHP package for working with JSON as markup. It offers a simple way to parse or render JSON data into readable HTML output, making it useful for Laravel and PHP projects that need to display or transform JSON content.
json_encode/json_decode's return-false-and-set-json_last_error() contract into thrown exceptions. The PM decision it informs is whether malformed payloads (third-party webhooks, cache entries, config blobs, API responses) should fail loudly at the boundary or degrade silently deeper in the stack. That is a real reliability decision with incident and on-call consequences, not a library preference.Json::decode() helper with typed exceptions that we own? Given 3 stars, zero dependents, and a 2019 last release, "buy" has almost no defensive value here.if (json_last_error() !== JSON_ERROR_NONE) checks with inconsistent messages and exit paths, a shared wrapper (internal) is a legitimate standards decision. The package is only evidence that the pattern is wanted, not that it should be vendored.Consider it only when all of the following hold:
JSON_THROW_ON_ERROR and JsonException do not exist. (Note: 7.2 and earlier are long past end-of-life; this is a shrinking set.)Look elsewhere (or write it yourself) when:
json_encode($v, JSON_THROW_ON_ERROR) / json_decode($s, true, 512, JSON_THROW_ON_ERROR). This package's core value proposition is now the language's default behavior.For executives (one paragraph): A tiny, unmaintained utility that makes PHP's built-in JSON functions throw exceptions instead of silently returning false. The language absorbed this behavior in PHP 7.3, so its window of value has closed. Recommendation: do not adopt as a dependency. If we want exception-based JSON at our boundaries — and we should — we replicate the behavior in roughly a day of internal work we fully control, or we simply rely on the native flag once we are on a supported PHP version. This is a hygiene note, not an investment.
For engineering (the actual ask):
Json helper that wraps json_encode/json_decode, throws a project-owned JsonException with the payload context attached (a field PHP's own exception won't give you), and is the single place we change when we move to JSON_THROW_ON_ERROR.json_decode return values leak past a boundary without a check; that is the failure mode the wrapper exists to prevent.How can I help you explore Laravel packages today?