ricbra / knmi-client
0.0.1
2016-11-29 20:48 UTC
Requires
- php: >=7.0
- php-http/client-implementation: ^1.0
- php-http/discovery: ^1.0
- php-http/httplug: ^1.0
- php-http/message-factory: ^1.0
- psr/http-message: ^1.0
Requires (Dev)
- guzzlehttp/psr7: ^1.0
- php-http/guzzle6-adapter: ^1.1
- php-http/message: ^1.0
- php-http/mock-client: ^0.3
- phpunit/phpunit: ^5.6
This package is not auto-updated.
Last update: 2024-10-26 20:26:43 UTC
README
KNMI client
This repository contains a very simplistic PHP client for the KNMI hourly and daily endpoints. The response from KNMI is rather unsuable and this client returns a nice formatted array. Not the best you can get, but better than the original.
Installation
Since we're using php-http you're free to choose your own HTTP client library. For more information on how to pick your favourite client see the docs.
Installation using latest Guzzle:
$ composer require php-http/guzzle6-adapter ricbra/knmi-client guzzlehttp/psr7 php-http/message
If you don't specify any php-http adapter Composer will complain:
$ composer require ricbra/knmi-client
./composer.json has been created
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.
Problem 1
- ricbra/knmi-client 1.0.x-dev requires php-http/client-implementation ^1.0 -> no matching package found.
- ricbra/knmi-client dev-master requires php-http/client-implementation ^1.0 -> no matching package found.
- Installation request for ricbra/knmi-client @dev -> satisfiable by ricbra/knmi-client[dev-master, 1.0.x-dev].
Usage
<?php require 'vendor/autoload.php'; $guzzleAdapter = new \Http\Adapter\Guzzle6\Client(); $client = new \Ricbra\Knmi\Client($guzzleAdapter); $data = $client->getDaily( new \DateTime('2012-01-01'), new \DateTime('2012-01-03'), [ '240' ], [ 'PX', 'PN' ] ); $data = $response = $client->getHourly( new \DateTime('2016-01-01 12:00'), new \DateTime('2016-01-01 13:00'), ['240'], ['P'] );