brookedot/weather-machine

PHP wrapper for the Weather Machine API

Maintainers

Package info

github.com/BrookeDot/weather-machine-php

pkg:composer/brookedot/weather-machine

Statistics

Installs: 13

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v1.0.1 2025-12-15 02:48 UTC

This package is auto-updated.

Last update: 2026-03-15 03:23:34 UTC


README

A PHP wrapper for the Weather Machine API.

Uses Sympfony HTTP Client.

Installation

composer require brookedot/weather-machine

Usage

use BrookeDot\WeatherMachine\WeatherMachine;

$weather = new WeatherMachine('your-api-key');

// Get hourly forecast
$hourly = $weather->location(47.608013, -122.335167)
    ->source('mock')
    ->units('si')
    ->hourly();

// Get current conditions
$current = $weather->location(47.608013, -122.335167)
    ->source('open_weather')
    ->currently();

// Get daily forecast
$daily = $weather->location(47.608013, -122.335167)
    ->source('open_weather')
    ->daily();

Available Methods

Required

  • location(float $lat, float $lon) - Set coordinates
  • source(string $source) - Set weather data source (defaults to 'mock')

Optional

  • units(string $unit) - Set units: us, si, ca, uk, m (default: us)
  • output(string $format) - Set output format: base, full (default: base)

Data Retrieval

  • get() - Get full response
  • currently() - Get current conditions
  • hourly() - Get hourly forecast
  • daily() - Get daily forecast
  • minutely() - Get minutely forecast
  • alerts() - Get weather alerts

Available Sources

  • accuweather
  • aeris_weather
  • apple_weather
  • custom_weather
  • foreca
  • mock
  • open_weather
  • pirate_weather
  • the_weather_company
  • tomorrow_io
  • visual_crossing
  • weatherbit

License

AGPL V3 or later License - see LICENSE file for details.