Skip to content

Commit 0f8d657

Browse files
committed
First Version
0 parents  commit 0f8d657

File tree

9 files changed

+587
-0
lines changed

9 files changed

+587
-0
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/vendor/
2+
composer.lock

.travis.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
language: php
2+
3+
php:
4+
- 5.6
5+
- 7.0
6+
- hhvm
7+
8+
before_script:
9+
- composer self-update
10+
- composer install --prefer-source --no-interaction --dev
11+
12+
script: phpunit

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2016 Pendo.nl
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
# PHP Wrapper for Pro6PP Api
2+
3+
[![Latest version on Packagist](https://img.shields.io/packagist/v/pendonl/laravel-fontawesome.svg?style=flat-square)](https://packagist.org/packages/pendonl/laravel-fontawesome)
4+
[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE)
5+
[![Travis branch](https://img.shields.io/travis/PendoNL/laravel-fontawesome/master.svg)](https://travis-ci.org/PendoNL/laravel-fontawesome)
6+
[![Scrutinizer](https://img.shields.io/scrutinizer/g/PendoNL/laravel-fontawesome.svg)](https://scrutinizer-ci.com/g/PendoNL/laravel-fontawesome/)
7+
[![SensioLabs Insight](https://img.shields.io/sensiolabs/i/e660c560-9d50-43e3-9be1-e556ba78f189.svg)](https://insight.sensiolabs.com/projects/e660c560-9d50-43e3-9be1-e556ba78f189)
8+
[![Github All Releases](https://img.shields.io/github/downloads/pendo/laravel-fontawesome/total.svg)](https://github.com/pendonl/laravel-fontawesome)
9+
10+
The `PendoNL/pro6pp-php-wrapper` package provides an easy to use way to communicate with Pro6PP's API to fetch location based data such as addresses, coordinates, etc. Below you can find a list all methods.
11+
12+
## Installation & Usage
13+
14+
Install the package using composer or by downloading the zip. When downloading the zip you only need to include Pro6pp.php in your page.
15+
16+
`composer require pendonl/pro6pp-php-wrapper`
17+
18+
Below you'll find a page with all methods. Please reference the class and API documentation by Pro6pp for all parameters.
19+
20+
[API Documentation by Pro6pp (Dutch)](https://www.pro6pp.nl/developers/basic-information)
21+
22+
```php
23+
<?php
24+
25+
require __DIR__ . '/vendor/autoload.php';
26+
27+
$Pro6pp = new \PendoNL\Pro6pp\Pro6pp('api_code', 'json');
28+
29+
/**
30+
* Autocomplete an address. This can be achieved in different ways
31+
* (1) With a nl_fourpp postalcode
32+
* (2) With a nl_sixpp postalcode
33+
* (3) With a nl_sixpp postalcode housenumber and extension
34+
*/
35+
36+
$Pro6pp->autocomplete(6225);
37+
$Pro6pp->autocomplete('6225XS');
38+
$Pro6pp->autocomplete('6225XS', 7);
39+
$Pro6pp->autocomplete('6225XS', 7, 'c');
40+
41+
/**
42+
* Reverse address look-up. Provide the method with valid lat/lng
43+
* and you'll be presented with an address if found.
44+
*/
45+
46+
$Pro6pp->reverse(50.858030, 5.717376);
47+
48+
/**
49+
* Find the nearest postalcodes from a given set of postalcodes compared
50+
* to a single postalcode. The second parameter takes an array with either
51+
* a nl_fourpp, a nl_sixpp or a set of lat/lng.
52+
*/
53+
54+
$Pro6pp->locator(['6220','6221','6223','6224'], ['nl_fourpp' => 6216]);
55+
56+
/**
57+
* Find all postals within a given range. The second parameter is in meters.
58+
*/
59+
60+
$Pro6pp->range(6225, 2500);
61+
62+
/**
63+
* Get autocomplete suggestions for city names, takes a second parameter for
64+
* the maximum number of results.
65+
*/
66+
67+
$Pro6pp->suggest('Maast', 10);
68+
69+
/**
70+
* Calculate the distance between two nl_fourpp, 3rd parameter can be set to 'road',
71+
* be carefull: this is for supported account only.
72+
*/
73+
74+
$Pro6pp->distance(6225, 6210, 'straight');
75+
76+
/**
77+
* Calculate distance between two coordinates
78+
*/
79+
80+
$Pro6pp->coordinate_distance(50.858030, 5.717376, 50.840078, 5.659258);
81+
```
82+
83+
## Security
84+
85+
If you discover any security related issues, please email joshua@pendo.nl instead of using the issue tracker.
86+
87+
## Credits
88+
89+
Thanks to Pro6PP for their efforts to create, maintain and update a postal database for a fair price.
90+
91+
## About Pendo
92+
Pendo is a webdevelopment agency based in Maastricht, Netherlands. If you'd like, you can [visit our website](https://pendo.nl).
93+
94+
## License
95+
96+
The MIT License (MIT). Please see [License File](LICENSE) for more information.

composer.json

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"name": "pendonl/pro6pp-php-wrapper",
3+
"description": "Wrapper for the Pro6PP API",
4+
"authors": [
5+
{
6+
"name": "Joshua de Gier",
7+
"email": "info@pendo.nl"
8+
}
9+
],
10+
"require": {
11+
"php": ">=5.6.0"
12+
},
13+
"require-dev": {
14+
"phpunit/phpunit": "~5.0"
15+
},
16+
"autoload": {
17+
"psr-4": {
18+
"PendoNL\\Pro6pp\\": "src/"
19+
}
20+
},
21+
"autoload-dev": {
22+
"psr-4": {
23+
"PendoNL\\Pro6pp\\Test\\": "tests"
24+
}
25+
},
26+
"license": "MIT"
27+
}

example.php

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
<?php
2+
3+
require __DIR__ . '/vendor/autoload.php';
4+
5+
$Pro6pp = new \PendoNL\Pro6pp\Pro6pp('api_code', 'json');
6+
7+
/**
8+
* Autocomplete an address. This can be achieved in different ways
9+
* (1) With a nl_fourpp postalcode
10+
* (2) With a nl_sixpp postalcode
11+
* (3) With a nl_sixpp postalcode housenumber and extension
12+
*/
13+
14+
$Pro6pp->autocomplete(6225);
15+
$Pro6pp->autocomplete('6225XS');
16+
$Pro6pp->autocomplete('6225XS', 7);
17+
$Pro6pp->autocomplete('6225XS', 7, 'c');
18+
19+
/**
20+
* Reverse address look-up. Provide the method with valid lat/lng
21+
* and you'll be presented with an address if found.
22+
*/
23+
24+
$Pro6pp->reverse(50.858030, 5.717376);
25+
26+
/**
27+
* Find the nearest postalcodes from a given set of postalcodes compared
28+
* to a single postalcode. The second parameter takes an array with either
29+
* a nl_fourpp, a nl_sixpp or a set of lat/lng.
30+
*/
31+
32+
$Pro6pp->locator(['6220','6221','6223','6224'], ['nl_fourpp' => 6216]);
33+
34+
/**
35+
* Find all postals within a given range. The second parameter is in meters.
36+
*/
37+
38+
$Pro6pp->range(6225, 2500);
39+
40+
/**
41+
* Get autocomplete suggestions for city names, takes a second parameter for
42+
* the maximum number of results.
43+
*/
44+
45+
$Pro6pp->suggest('Maast', 10);
46+
47+
/**
48+
* Calculate the distance between two nl_fourpp, 3rd parameter can be set to 'road',
49+
* be carefull: this is for supported account only.
50+
*/
51+
52+
$Pro6pp->distance(6225, 6210, 'straight');
53+
54+
/**
55+
* Calculate distance between two coordinates
56+
*/
57+
58+
$Pro6pp->coordinate_distance(50.858030, 5.717376, 50.840078, 5.659258);

phpunit.xml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<phpunit backupGlobals="false"
3+
backupStaticAttributes="false"
4+
bootstrap="vendor/autoload.php"
5+
colors="true"
6+
convertErrorsToExceptions="true"
7+
convertNoticesToExceptions="true"
8+
convertWarningsToExceptions="true"
9+
processIsolation="false"
10+
stopOnFailure="false"
11+
syntaxCheck="false">
12+
<testsuites>
13+
<testsuite name="Pendo Test Suite">
14+
<directory suffix=".php">./tests/</directory>
15+
</testsuite>
16+
</testsuites>
17+
</phpunit>

0 commit comments

Comments
 (0)