diff --git a/.travis.yml b/.travis.yml index bd9b6b3..8641136 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,9 +1,9 @@ language: php php: - - 5.4 - - 5.5 - - 5.6 + - 7.0 + - 7.1 + - 7.2 branches: only: diff --git a/Api/ApiClient.php b/Api/ApiClient.php new file mode 100644 index 0000000..e933372 --- /dev/null +++ b/Api/ApiClient.php @@ -0,0 +1,22 @@ + '']) + * @method array bulkLookup(array $parameters = ['postcodes' => []]) + * @method array reverseGeocode(array $parameters = ['longitude' => '', 'latitude' => '', 'limit' => '', 'radius' => '']) + * @method array bulkReverseGeocode(array $parameters = []) + * @method array matching(array $parameters = ['query' => '', 'limit' => '']) + * @method array validate(array $parameters = ['postcode' => '']) + * @method array autocomplete(array $parameters = ['postcode' => '', 'limit' => '']) + * @method array random() + * @method array outwardCodeLookup(array $parameters = ['postcode' => '']) + */ +class ApiClient extends GuzzleClient +{ +} diff --git a/Api/ClientFactory.php b/Api/ClientFactory.php index 3f0cc68..6b0fa40 100644 --- a/Api/ClientFactory.php +++ b/Api/ClientFactory.php @@ -25,7 +25,7 @@ class ClientFactory */ public function create($baseUrl = self::DEFAULT_BASE_URL) { - return new GuzzleClient(new Client(), $this->getServiceDescription($baseUrl)); + return new ApiClient(new Client(), $this->getServiceDescription($baseUrl)); } /** @@ -59,7 +59,7 @@ protected function getServiceDescription($baseUrl) 'responseModel' => 'getResponse', 'parameters' => array( 'postcodes' => array( - 'location' => 'postField', + 'location' => 'formParam', 'description' => 'The postcodes to look up (max 100).', 'required' => true ) @@ -98,7 +98,7 @@ protected function getServiceDescription($baseUrl) 'responseModel' => 'getResponse', 'parameters' => array( 'geolocations' => array( - 'location' => 'postField', + 'location' => 'formParam', 'description' => 'The latitude and longitude coordinates to look up.', 'required' => true ) diff --git a/README.md b/README.md index 41be95d..f317c31 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,10 @@ A bundle for querying the [postcodes.io](http://postcodes.io) web service. [License](LICENSE) +Note from DailyInfo - SF4 work in progress +==== + +This is a fork of the excellent [Symfony 2 bundle by Chris Collins of Box UK](https://github.com/boxuk/postcodes-io-bundle) that has been updated to support Symfony 3/4. The tests are failing due to the updated version of Guzzle being used in this fork, use it at your own risk. The version of Guzzle has been updated to v6, which means that the mocking of clients must be changed - if you find yourself using this fork and have Guzzle testing experience, please feel free to submit a pull request. Installation ------------ diff --git a/Resources/config/services.xml b/Resources/config/services.xml index b92d553..2554af0 100644 --- a/Resources/config/services.xml +++ b/Resources/config/services.xml @@ -4,14 +4,10 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd"> - - BoxUk\PostcodesIoBundle\Api\ClientFactory - GuzzleHttp\Command\Guzzle\GuzzleClient - - - - + + + %box_uk_postcodes_io.base_url% diff --git a/composer.json b/composer.json index adb5a80..f62b664 100644 --- a/composer.json +++ b/composer.json @@ -1,7 +1,7 @@ { "name": "boxuk/postcodes-io-bundle", "type": "library", - "description": "A Symfony2 bundle for interaction with the postcodes.io service.", + "description": "A Symfony 3/4 bundle for interaction with the postcodes.io service.", "keywords": ["postcode", "postcodes.io", "guzzle"], "license": "MIT", "authors": [ @@ -11,12 +11,12 @@ } ], "require": { - "php": ">=5.4.0", - "symfony/framework-bundle": "2.*", - "guzzlehttp/guzzle-services": "~0.1" + "php": "^7.0", + "symfony/framework-bundle": "^3.0|^4.0", + "guzzlehttp/guzzle-services": "^1.0" }, "require-dev": { - "symfony/browser-kit": "~2.5", + "symfony/browser-kit": "^3.0|^4.0", "phpunit/phpunit": "~4.7", "squizlabs/php_codesniffer": "~1.5", "phpmd/phpmd": "~2.0",