Download the PHP package vemcogroup/laravel-weather without Composer

On this page you can find all versions of the php package vemcogroup/laravel-weather. 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 laravel-weather

Laravel Weather

Latest Version on Packagist Total Downloads tests

Description

This package allows you to fetch weather data from different weather providers

Installation

You can install the package via composer:

The package will automatically register its service provider.

To publish the config file to config/weather.php run:

The default configuration can be seen here

Usage

At the moment this package support the following weather services, you can update WEATHER_PROVIDER to one of the following

Service Provider name Website Geocoding Remarks
Dark Sky darksky https://darksky.net Manual Deprecated, not able to acquire api key https://blog.darksky.net. Will continue to function until March 31st, 2023.
Weatherstack weatherstack https://weatherstack.com Auto For historical data a minimum Standard license is required. For forecast data a minimum Professional license is required.
WeatherKit weatherkit https://developer.apple.com/weatherkit/ Auto Needs an apple developer account.

For other weather services fill free to create an issue or make a Pull Request.

For Manual geocoding you need a Google geocode api key.
Acquire it here https://developers.google.com/maps/documentation/geocoding/start and insert it into your .env file.

Request

Start by setting up your request

By default, it caches the weather response for 24hrs (86.400sec), this can be changed by setting a second parameter to cache timeout (in seconds)

Units
There two available unit types, default is Metric:

Metric (m): Vemcogroup\Weather\Providers\Provider::WEATHER_UNITS_METRIC
Fahrenheit (f): Vemcogroup\Weather\Providers\Provider::WEATHER_UNITS_FAHRENHEIT

To change the response units you can do the following:

Locale
To change the locale for descriptions, summaries and other texts in the response, do the following:

Locale need to be an 2-letter ISO Code of your preferred language.

Dates If you need to select the dates to get weather data for E.g for historical data, set the dates like this:

All dates in the array need to Carbon objects.

Options
If you need to set any extra options based in your selected weather provider you can do the following:

Current weather and forecast

To get current weather and forecast response you can do this:

Weather response will always be a Collection of responses.
Forecast days depends on weather service provider.

To get current weather data:

To get forecast you can take first element of response and get the forecast like this:

Afterward run through the array with represent each day of the forecast on a DataPoint object.

Historical

To get historical data you can do this:

Remember to set dates on request.
Response will be a collection with keys representing the dates for historical data.

Response

To see what response data is available look into source code /src/Objects


All versions of laravel-weather with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0
ext-json Version *
firebase/php-jwt Version ^6.4
laravel/framework Version ^9.0|^10.0
spatie/geocoder Version ^3.1
ext-openssl Version *
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 vemcogroup/laravel-weather contains the following files

Loading the files please wait ....