Download the PHP package dnsimmons/openweather without Composer

On this page you can find all versions of the php package dnsimmons/openweather. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package openweather

OpenWeather

Latest Stable Version Latest Unstable Version Total Downloads License

About

OpenWeather is a Laravel package simplifying working with the free Open Weather Map APIs.

OpenWeather takes care of making requests to various free Open Weather Map APIs and returns well-structured easy to use weather data including conditions, temperatures, humidity, pressure, wind, location, and timestamp data.

Take a look at the Example Usage section output below for a typical structured response.

Supported APIs

The package supports the following free Open Weather Map APIs:

Free API Limitations

Requirements

Install

Use composer to install the package

$ composer require dnsimmons/openweather

For Laravel >= 5.5 the package is auto-discovered.

For older Laravel versions prior to 5.5 add the service provider to your config/app.php along with an alias:

'providers' => [
    ...
    Dnsimmons\OpenWeather\OpenWeatherServiceProvider::class,
];

'aliases' => [
    ...
    'OpenWeather' => Dnsimmons\OpenWeather\OpenWeather::class,  
];

Publish the required package configuration file using the artisan command:

$ php artisan vendor:publish

Edit the .env file in your Laravel instance add the following environment variables and add your OpenWeather API key:

OPENWEATHER_API_KEY="your-api-key"
OPENWEATHER_API_LANG="en"
OPENWEATHER_API_DATE_FORMAT="m/d/Y"
OPENWEATHER_API_TIME_FORMAT="h:i A"
OPENWEATHER_API_DAY_FORMAT="l"

Example Usage

In the example below we fetch the current weather by postal code.

$weather = new OpenWeather();
$current = $weather->getCurrentWeatherByPostal('02111');
print_r($current);

Output

Array
(
    [formats] => Array
        (
            [lang] => en
            [date] => m/d/Y
            [day] => l
            [time] => h:i A
            [units] => imperial
        )

    [datetime] => Array
        (
            [timestamp] => 1593387767
            [timestamp_sunrise] => 1593335394
            [timestamp_sunset] => 1593390304
            [formatted_date] => 06/28/2020
            [formatted_day] => Sunday
            [formatted_time] => 11:42 PM
            [formatted_sunrise] => 09:09 AM
            [formatted_sunset] => 12:25 AM
        )

    [location] => Array
        (
            [id] => 4930956
            [name] => Boston
            [country] => US
            [latitude] => 42.36
            [longitude] => -71.06
        )

    [condition] => Array
        (
            [id]   => 801
            [name] => Rain
            [desc] => light rain
            [icon] => https://openweathermap.org/img/w/10d.png
        )

    [wind] => Array
        (
            [speed] => 11.5
            [deg] => 113
            [direction] => SE
        )

    [forecast] => Array
        (
            [temp] => 67
            [temp_min] => 64
            [temp_max] => 68
            [pressure] => 1007
            [humidity] => 88
        )

)

Methods

All methods return an array on success and FALSE on failure.

Current Weather Methods

getCurrentWeatherByCityName(string $city, string $units)

Params

getCurrentWeatherByCityId(int $id, string $units)

Params

getCurrentWeatherByCoords(string $latitude, string $longitude, string $units)

Params

getCurrentWeatherByPostal(string $postal, string $units)

Params

4 Day 3 Hour Forecast Methods

getForecastWeatherByCityName(string $city, string $units)

Params

getForecastWeatherByCityId(int $id, string $units)

Params

getForecastWeatherByCoords(string $latitude, string $longitude, string $units)

Params

getForecastWeatherByPostal(string $postal, string $units)

Params

Onecall Request Methods

getOnecallWeatherByCoords(string $latitude, string $longitude, string $units, string $exclude)

Params

Onecall Historical Request Methods

getHistoricalWeatherByCoords(string $latitude, string $longitude, string $date, string $units)

Params


All versions of openweather with dependencies

PHP Build Version
Package Version
No informations.
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package dnsimmons/openweather contains the following files

Loading the files please wait ....