ekstremedia/laravel-yr
Laravel package that wraps the Yr weather service (MET Norway), letting you fetch location-based forecasts and weather data in your PHP applications. Clean, simple API with easy configuration and seamless Laravel integration for any project.
Architecture fit: The package remains a thin, framework-native integration around MET Norway's Locationforecast/Nowcast APIs, sitting cleanly in Laravel's cache, HTTP client, and config layers. v1.2.1 does not alter that shape; it corrects the caching contract so the package now respects the upstream provider's freshness signals rather than its own static TTL. That is architecturally the right call — caching lifetime is owned by MET, and the package now defers to it.
Integration feasibility: No public API changes, no config keys added or removed, no migration required. Existing consumers calling the forecast/nowcast/sun-moon methods see identical signatures. The behavioural deltas are all in edge-case handling (expired Expires, 304 responses, non-JSON bodies, failed requests), which most integrations will experience as improved correctness rather than different results. Integration effort for an existing adopter is a composer bump and a regression pass.
Technical risk: Low but non-zero, and concentrated in three areas:
cache_ttl to reduce upstream calls will now get MET's Expires (often 30–60 min for forecasts, shorter for nowcast) instead. Effective cache hit rates and outbound request volume will change — generally downward in freshness lag, upward in request count. Anyone rate-limiting against MET should re-measure.If-Modified-Since introduces stateful behaviour that previously didn't exist. It's a resilience improvement, but it means a stale-but-valid forecast can be served for up to 24 h if MET keeps returning 304. Acceptable for weather; worth confirming it's acceptable for the consumers' display requirements.null on non-JSON. Returning null instead of throwing is more forgiving but shifts failure detection to the caller. Teams relying on exceptions for alerting need to check for null explicitly.Key questions:
cache_ttl longer than MET's Expires (e.g. to cap outbound calls)?null-on-non-JSON change makes that distinction the caller's responsibility.Expires floor of 60 s compatible with any tight polling loops?Stack fit: Unchanged — Laravel 10+ with the framework HTTP client and cache store, no new dependencies, no service provider or facade changes. It fits the same slot in the architecture as before: a cached read-through adapter to an external forecast API.
Migration path: Composer update to ^1.2.1. No code changes required for correctness. The only deliberate action item is auditing any place where cache_ttl / nowcast_cache_ttl were tuned as a cost or rate-limit control rather than a freshness control — those settings are now advisory fallbacks, not overrides.
Compatibility: No breaking changes to the public API or config surface. The Laravel 10 / Carbon 2 Expires-in-the-past fix removes a latent bug on that combination (previously a past timestamp produced a TTL equal to the full negative offset rather than the 60 s floor). No PHP version or dependency constraint changes are implied by the notes.
Sequencing:
null returns and 304 handling if not present.null (non-JSON and failure cases).cache_ttl values that were set for rate-limiting reasons and move that control to an explicit layer if still needed.Maintenance: Negligible ongoing cost. This is a bug-fix release with no deprecations and no expansion of the public surface, so the maintenance burden is unchanged. Style-only Pint churn does not affect consumers. The package still tracks an external, unversioned government API, which remains the principal long-term maintenance exposure regardless of this release.
Support: The fixes reduce the most common support categories — stale-then-null data, cached failures, crashes on non-JSON error pages, and Carbon 2 TTL oddities. Expect fewer "why is my forecast null" tickets and more "why are we calling MET more often" questions during the transition. Document the new caching semantics (MET Expires wins, 60 s floor, 24 h last-good retention) in the team's internal notes, as the previous behaviour is likely baked into assumptions.
Scaling: Slightly higher outbound request volume under load if prior configs used long TTLs; the 304 revalidation path partially offsets this by avoiding full body transfers. The 60 s floor bounds the worst case for pathological Expires values. No new memory or storage pressure beyond retaining one body per cache key for up to a day.
Failure modes:
null returned silently; callers must handle. Log/alert on null rate.Expires in the past → cached 60 s (bounded, safe).Ramp-up: Very low. No new concepts for a developer already familiar with the package; the only learning is the caching contract (MET-owned TTL, 304 revalidation, null on invalid body). A short note in the team wiki plus the two or three edge cases above is sufficient — call it under an hour for an experienced Laravel developer, plus the staging measurement exercise if outbound volume matters.
How can I help you explore Laravel packages today?