Download the PHP package epixian/laravel-noaa without Composer
On this page you can find all versions of the php package epixian/laravel-noaa. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download epixian/laravel-noaa
More information about epixian/laravel-noaa
Files in epixian/laravel-noaa
Package laravel-noaa
Short Description A wrapper for the NOAA's climate data API at https://ncdc.noaa.giv/cdo-web/api/v2
License MIT
Informations about the package laravel-noaa
Laravel NOAA
Laravel NOAA is a wrapper for the NOAA's climate data API at https://ncdc.noaa.giv/cdo-web/api/v2.
Installation
From your source directory, use the following command:
Publish assets:
Configuration
Add the following to your .env
file:
Register for a token at https://www.ncdc.noaa.gov/cdo-web/token.
Usage
For a full listing of API request parameters, visit: https://www.ncdc.noaa.gov/cdo-web/webservices/v2.
Required
{requestType}()
where {requestType}
is one of:
datasets
dataCategories
dataTypes
locationCategories
locations
stations
data
Sets the type of request to be generated.
get()
Executes the request and returns a JSON-decoded result (typically an array) depending on the API response. Note: requires a request type method to be previously called and must be the last call when chaining methods.
Alternatively, you may supply a single string
argument to get()
representing an id
belonging to that request type (valid for all request type methods except data()
:
Optional
from(startDate)
startDate
is a string containing a valid ISO formatted date (e.g. '2010-10-02'
). Note: this field is required for the data()
request type.
to(endDate)
endDate
is a string containing a valid ISO formatted date (e.g. '2010-10-07'
). Note: this field is required for the data()
request type.
orderBy(field, direction)
field
is a string containing one of: id
, name
, mindate
, maxdate
, or datacoverage
.
direction
is an optional string containing either asc
(default if omitted) or desc
.
limit(number)
Defaults to 25 if omitted.
offset(number)
Defaults to 0 if omitted. Note: the API returns results with indexes starting at 1. offset(0)
and offset(1)
produce equivalent results.
Laravel-style helpers
A number of method aliases are provided for convenience:
latest()
- equivalent toorderBy('maxdate', 'desc')
oldest()
- equivalent toorderBy('mindate', 'asc')
skip(number)
- alias ofoffset()
take(number)
- alias oflimit()
where(field, value)
- sets a generic parameter (see https://www.ncdc.noaa.gov/cdo-web/webservices/v2)
Request constraints may be chained together to refine or limit the data returned:
Additional constraint methods specific to the request type are detailed below.
Datasets
Returns the available dataset(s) applicable to the given constraints (if any). The following optional constraint methods are available:
withDataType(id)
id
is a string containing a single valid data type ID, or an array of strings representing multiple data type IDs.
withLocation(id)
id
is a string containing a single valid location ID, or an array of strings representing multiple location IDs.
withStation(id)
id
is a string containing a single valid station ID, or an array of strings representing multiple station IDs.
Data Categories
Returns the available data category(s) applicable to the given constraints (if any). The following optional constraint methods are available:
withDataset(id)
id
is a string containing a single valid dataset ID, or an array of strings representing multiple dataset IDs.
withLocation(id)
id
is a string containing a single valid location ID, or an array of strings representing multiple location IDs.
withStation(id)
id
is a string containing a single valid station ID, or an array of strings representing multiple station IDs.
Data Types
Returns the available data type(s) applicable to the given constraints (if any). The following optional constraint methods are available:
withDataset(id)
id
is a string containing a single valid dataset ID, or an array of strings representing multiple dataset IDs.
withLocation(id)
id
is a string containing a single valid location ID, or an array of strings representing multiple location IDs.
withStation(id)
id
is a string containing a single valid station ID, or an array of strings representing multiple station IDs.
withDataCategory(id)
id
is a string containing a single valid data category ID, or an array of strings representing multiple data category IDs.