Download the PHP package vertigolabs/overcast without Composer
On this page you can find all versions of the php package vertigolabs/overcast. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download vertigolabs/overcast
More information about vertigolabs/overcast
Files in vertigolabs/overcast
Package overcast
Short Description An easy to use wrapper for the Dark Sky API (formerly Forecast.io)
License MIT
Informations about the package overcast
Overcast
An easy to use wrapper for the Dark Sky API (formerly Forecast.io).
Overcast will query the Dark Sky API for weather information for the longitude and latitude you specify. Additionally you may specify the specific time, past or present.
See the Dark Sky API documentation for more information.
Installation
Installation is as simple as using Composer:
Client Adapters
Overcast uses client adapters to connect to the Dark Sky API. This gives you the ability to create your own adapter for whatever HTTP client you'd like to use. This is especially useful for people who have special needs when dealing with retrieving data from third parties (firewalls, proxies, etc)
Overcast comes with two client adapters ready for use, FileGetContentsClientAdapter and GuzzleClientAdapter. You can also create your own by simply implementing the ClientAdapterInterface
By default, you do not have to specify which adapter to use. Overcast will automatically use the best client adapter available. If Guzzle is installed, it will use the GuzzleClientAdaptor, otherwise it will fallback to the FileGetContentsClientAdapter.
If you do wish to specify the client adapter, you'd do this with the second parameter when instancing the Overcast class:
Example
Since the Dark Sky API is simple, Overcast is equally easy to use. Simply create an instance of the Overcast class, then call the getForecast() method.
Overcast::getForecast() returns a nicely structured Forecast object which contains other data structures for handy access to all of the response data from Dark Sky.
This will output:
Todo
- Accept additional API options