{"id":34639897,"url":"https://github.com/projectsaturnstudios/nws","last_synced_at":"2026-01-20T16:25:55.417Z","repository":{"id":316965512,"uuid":"1065385097","full_name":"projectsaturnstudios/nws","owner":"projectsaturnstudios","description":"National Weather Service (NWS) integration for Laravel applications.","archived":false,"fork":false,"pushed_at":"2025-09-27T16:09:43.000Z","size":18,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-12-26T06:20:56.066Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/projectsaturnstudios.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-09-27T16:08:11.000Z","updated_at":"2025-09-27T16:09:14.000Z","dependencies_parsed_at":"2025-09-29T21:46:59.205Z","dependency_job_id":null,"html_url":"https://github.com/projectsaturnstudios/nws","commit_stats":null,"previous_names":["projectsaturnstudios/nws"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/projectsaturnstudios/nws","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/projectsaturnstudios%2Fnws","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/projectsaturnstudios%2Fnws/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/projectsaturnstudios%2Fnws/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/projectsaturnstudios%2Fnws/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/projectsaturnstudios","download_url":"https://codeload.github.com/projectsaturnstudios/nws/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/projectsaturnstudios%2Fnws/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28607018,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-20T16:10:39.856Z","status":"ssl_error","status_checked_at":"2026-01-20T16:10:39.493Z","response_time":117,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-12-24T17:15:43.887Z","updated_at":"2026-01-20T16:25:55.392Z","avatar_url":"https://github.com/projectsaturnstudios.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Laravel NWS (National Weather Service) Package\n\nA Laravel package for integrating with the National Weather Service API. Get weather forecasts, current conditions, and alerts directly from the source - no API key required!\n\n## Features\n\n- 🌤️ **Current Weather \u0026 Forecasts** - Get detailed weather information\n- ⚡ **Weather Alerts** - Real-time warnings, watches, and advisories  \n- 🎯 **Location-based** - Support for coordinates and addresses\n- 🚀 **Laravel Native** - Built with Laravel HTTP Client and Facades\n- 💾 **Smart Caching** - Configurable caching for optimal performance\n- 🔧 **Builder Pattern** - Fluent, chainable API for easy usage\n- 📊 **Rich Data** - Strongly typed DTOs using Spatie Laravel Data\n\n## Installation\n\n```bash\ncomposer require projectsaturnstudios/nws\n```\n\nPublish the configuration file:\n\n```bash\nphp artisan vendor:publish --tag=nws-config\n```\n\n## Quick Start\n\n### Using the Facade\n\n```php\nuse ProjectSaturnStudios\\NWS\\Support\\Facades\\NWS;\n\n// Get current weather for Tampa\n$weather = NWS::forTampa()-\u003egetCurrentWeather();\n\n// Get 7-day forecast for any location\n$forecast = NWS::location(40.7128, -74.0060)-\u003egetForecast();\n\n// Get weather alerts for Florida\n$alerts = NWS::getAlertsForArea('FL');\n```\n\n### Using the Builder Pattern\n\n```php\nuse ProjectSaturnStudios\\NWS\\NationalWeatherService;\n\n$nws = NationalWeatherService::make()\n    -\u003elocation(27.9506, -82.4572)  // Tampa coordinates\n    -\u003eunits('us');                  // US customary units\n\n$currentWeather = $nws-\u003egetCurrentWeather();\n$hourlyForecast = $nws-\u003egetHourlyForecast();\n$alerts = $nws-\u003egetAlerts();\n```\n\n## API Methods\n\n### Weather Data\n\n```php\n// Get current conditions and forecast\n$weather = NWS::location($lat, $lon)-\u003egetCurrentWeather();\n\n// Get 7-day forecast\n$forecast = NWS::location($lat, $lon)-\u003egetForecast();\n\n// Get hourly forecast\n$hourly = NWS::location($lat, $lon)-\u003egetHourlyForecast();\n\n// Get point information (grid coordinates, office, etc.)\n$point = NWS::location($lat, $lon)-\u003egetPoint();\n```\n\n### Weather Alerts\n\n```php\n// Get alerts for a state/area\n$alerts = NWS::getAlertsForArea('FL');\n\n// Get alerts for a specific zone\n$alerts = NWS::getAlertsForZone('FLZ151');\n\n// Get alerts for coordinates\n$alerts = NWS::location($lat, $lon)-\u003egetAlerts();\n\n// Filter severe alerts\n$severeAlerts = $alerts-\u003egetSevereAlerts();\n$activeAlerts = $alerts-\u003egetActiveAlerts();\n```\n\n### Configuration Options\n\n```php\n// Set units (us or si)\n$nws = NWS::make()-\u003eunits('si');\n\n// Enable experimental features\n$nws = NWS::make()-\u003ewithFeatureFlags([\n    'forecast_temperature_qv',\n    'forecast_wind_speed_qv'\n]);\n```\n\n## Response Data\n\nAll responses are strongly typed using Spatie Laravel Data:\n\n```php\n$forecast = NWS::forTampa()-\u003egetForecast();\n\n// Access forecast periods\nforeach ($forecast-\u003eperiods as $period) {\n    echo $period-\u003ename;                    // \"This Afternoon\"\n    echo $period-\u003etemperature;             // 89\n    echo $period-\u003eshortForecast;           // \"Partly Sunny\"\n    echo $period-\u003edetailedForecast;        // Full description\n    echo $period-\u003eprobabilityOfPrecipitation-\u003evalue; // 20\n}\n\n// Helper methods\n$todaysPeriods = $forecast-\u003egetTodaysPeriods();\n$currentPeriod = $forecast-\u003egetCurrentPeriod();\n```\n\n## Configuration\n\nThe package includes comprehensive configuration options:\n\n```php\n// config/nws.php\nreturn [\n    'base_url' =\u003e 'https://api.weather.gov',\n    'user_agent' =\u003e 'Your App Name (contact@example.com)',\n    'timeout' =\u003e 30,\n    'cache' =\u003e [\n        'enabled' =\u003e true,\n        'ttl' =\u003e [\n            'forecasts' =\u003e 1800,  // 30 minutes\n            'alerts' =\u003e 300,      // 5 minutes\n            'points' =\u003e 86400,    // 24 hours\n        ],\n    ],\n    'default_location' =\u003e [\n        'latitude' =\u003e 27.9506,   // Tampa\n        'longitude' =\u003e -82.4572,\n    ],\n];\n```\n\n## Caching\n\nThe package automatically caches API responses based on configuration:\n\n- **Points/Offices**: 24 hours (rarely change)\n- **Forecasts**: 30 minutes (updated regularly)  \n- **Observations**: 10 minutes (current conditions)\n- **Alerts**: 5 minutes (time-sensitive)\n\n## Error Handling\n\nThe package includes automatic retry logic for temporary failures:\n\n```php\ntry {\n    $weather = NWS::forTampa()-\u003egetCurrentWeather();\n} catch (\\Exception $e) {\n    // Handle API errors\n    logger()-\u003eerror('Weather API failed', ['error' =\u003e $e-\u003egetMessage()]);\n}\n```\n\n## Requirements\n\n- PHP 8.2+\n- Laravel 10+\n- Guzzle HTTP Client (via Laravel HTTP Client)\n\n## About the NWS API\n\nThe National Weather Service API is:\n- **Free** - No API key required\n- **Authoritative** - Direct from the source\n- **Comprehensive** - Forecasts, observations, alerts\n- **Reliable** - Government-maintained infrastructure\n\n## License\n\nMIT License. See LICENSE file for details.\n\n## Contributing\n\nContributions welcome! Please see CONTRIBUTING.md for guidelines.\n\n\n\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprojectsaturnstudios%2Fnws","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fprojectsaturnstudios%2Fnws","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprojectsaturnstudios%2Fnws/lists"}