Skip to content

Commit d975c76

Browse files
Adding Laravel 5.6 support
1 parent 099689f commit d975c76

File tree

11 files changed

+28
-63
lines changed

11 files changed

+28
-63
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ language: php
33
sudo: false
44

55
php:
6-
- 7.0
6+
- 7.1.3
77
- 7.1
88
- 7.2
99
- nightly

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Feel free to check out the [releases](https://github.com/ARCANEDEV/GeoIP/release
2020

2121
* Well tested with maximum code quality.
2222
* Easy setup & configuration.
23-
* Laravel `5.1 | 5.2 | 5.3 | 5.4 | 5.5` are supported.
23+
* Laravel `5.1 | 5.2 | 5.3 | 5.4 | 5.5 | 5.6` are supported.
2424
* Well documented & IDE Friendly.
2525
* Made with :heart: & :coffee:.
2626

@@ -38,7 +38,7 @@ If you discover any security related issues, please email arcanedev-maroc@gmail.
3838

3939
Any ideas are welcome. Feel free to submit any issues or pull requests, please check the [contribution guidelines](CONTRIBUTING.md).
4040

41-
[badge_laravel]: https://img.shields.io/badge/Laravel-5.1%20to%205.5-orange.svg?style=flat-square
41+
[badge_laravel]: https://img.shields.io/badge/Laravel-5.1%20to%205.6-orange.svg?style=flat-square
4242
[badge_license]: https://img.shields.io/packagist/l/arcanedev/geo-ip.svg?style=flat-square
4343

4444
[badge_build]: https://img.shields.io/travis/ARCANEDEV/GeoIP.svg?style=flat-square

_docs/0-Home.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ GeoIP package for Laravel.
66

77
* Well tested with maximum code quality.
88
* Easy setup & configuration.
9-
* Laravel `5.1 | 5.2 | 5.3 | 5.4 | 5.5` are supported.
9+
* Laravel `5.1 | 5.2 | 5.3 | 5.4 | 5.5 | 5.6` are supported.
1010
* Well documented & IDE Friendly.
1111
* Made with :heart: & :coffee:.
1212

_docs/1-Installation-and-Setup.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,19 @@ The GeoIP package has a few system requirements:
1313
| ![GeoIP v2.0.x][geo_ip_2_0_x] | ![Laravel v5.1][laravel_5_1] ![Laravel v5.2][laravel_5_2] ![Laravel v5.3][laravel_5_3] |
1414
| ![GeoIP v2.1.x][geo_ip_2_1_x] | ![Laravel v5.4][laravel_5_4] |
1515
| ![GeoIP v2.2.x][geo_ip_2_2_x] | ![Laravel v5.5][laravel_5_5] |
16+
| ![GeoIP v2.3.x][geo_ip_2_3_x] | ![Laravel v5.6][laravel_5_6] |
1617

1718
[laravel_5_1]: https://img.shields.io/badge/v5.1-supported-brightgreen.svg?style=flat-square "Laravel v5.1"
1819
[laravel_5_2]: https://img.shields.io/badge/v5.2-supported-brightgreen.svg?style=flat-square "Laravel v5.2"
1920
[laravel_5_3]: https://img.shields.io/badge/v5.3-supported-brightgreen.svg?style=flat-square "Laravel v5.3"
2021
[laravel_5_4]: https://img.shields.io/badge/v5.4-supported-brightgreen.svg?style=flat-square "Laravel v5.4"
2122
[laravel_5_5]: https://img.shields.io/badge/v5.5-supported-brightgreen.svg?style=flat-square "Laravel v5.5"
23+
[laravel_5_6]: https://img.shields.io/badge/v5.6-supported-brightgreen.svg?style=flat-square "Laravel v5.6"
2224

2325
[geo_ip_2_0_x]: https://img.shields.io/badge/version-2.0.*-blue.svg?style=flat-square "GeoIP v2.0.*"
2426
[geo_ip_2_1_x]: https://img.shields.io/badge/version-2.1.*-blue.svg?style=flat-square "GeoIP v2.1.*"
2527
[geo_ip_2_2_x]: https://img.shields.io/badge/version-2.2.*-blue.svg?style=flat-square "GeoIP v2.2.*"
28+
[geo_ip_2_3_x]: https://img.shields.io/badge/version-2.3.*-blue.svg?style=flat-square "GeoIP v2.3.*"
2629

2730
## Composer
2831

composer.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@
1313
}
1414
],
1515
"require": {
16-
"php": ">=7.0",
17-
"arcanedev/support": "~4.2.0",
16+
"php": ">=7.1.3",
17+
"arcanedev/support": "~4.3.0",
1818
"guzzlehttp/guzzle": "~6.0"
1919
},
2020
"require-dev": {
21-
"orchestra/testbench": "~3.5.0",
22-
"phpunit/phpunit": "~6.0",
23-
"phpunit/phpcov": "~4.0",
21+
"orchestra/testbench": "~3.6.0",
22+
"phpunit/phpunit": "~7.0",
23+
"phpunit/phpcov": "~5.0",
2424
"geoip2/geoip2": "~2.6"
2525
},
2626
"autoload": {

config/geoip.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
| -----------------------------------------------------------------
1616
*/
1717

18-
'supported' => [
18+
'drivers' => [
1919
'freegeoip' => [
2020
'driver' => Arcanedev\GeoIP\Drivers\FreeGeoIpDriver::class,
2121
'options' => [

src/DriverManager.php

Lines changed: 12 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -23,44 +23,7 @@ class DriverManager extends Manager implements DriverFactory
2323
*/
2424
public function getDefaultDriver()
2525
{
26-
return $this->getConfig('default');
27-
}
28-
29-
/**
30-
* Get the driver class.
31-
*
32-
* @param string $key
33-
*
34-
* @return string
35-
*/
36-
private function getDriverClass($key)
37-
{
38-
return $this->getConfig("supported.$key.driver");
39-
}
40-
41-
/**
42-
* Get the driver options.
43-
*
44-
* @param string $key
45-
*
46-
* @return array
47-
*/
48-
private function getDriverOptions($key)
49-
{
50-
return $this->getConfig("supported.$key.options", []);
51-
}
52-
53-
/**
54-
* Get the config.
55-
*
56-
* @param string $key
57-
* @param mixed|null $default
58-
*
59-
* @return mixed
60-
*/
61-
public function getConfig($key, $default = null)
62-
{
63-
return $this->config()->get("geoip.$key", $default);
26+
return $this->config()->get("geoip.default");
6427
}
6528

6629
/**
@@ -81,7 +44,7 @@ private function config()
8144
/**
8245
* Build the 'ip-api' driver.
8346
*
84-
* @return Drivers\IpApiDriver
47+
* @return \Arcanedev\GeoIP\Drivers\AbstractDriver
8548
*/
8649
protected function createIpApiDriver()
8750
{
@@ -91,7 +54,7 @@ protected function createIpApiDriver()
9154
/**
9255
* Build the 'freegeoip' driver.
9356
*
94-
* @return Drivers\FreeGeoIpDriver
57+
* @return \Arcanedev\GeoIP\Drivers\AbstractDriver
9558
*/
9659
protected function createFreegeoipDriver()
9760
{
@@ -101,7 +64,7 @@ protected function createFreegeoipDriver()
10164
/**
10265
* Get the 'maxmind-database' driver.
10366
*
104-
* @return mixed
67+
* @return \Arcanedev\GeoIP\Drivers\AbstractDriver
10568
*/
10669
protected function createMaxmindDatabaseDriver()
10770
{
@@ -111,7 +74,7 @@ protected function createMaxmindDatabaseDriver()
11174
/**
11275
* Get the 'maxmind-api' driver.
11376
*
114-
* @return Drivers\MaxmindApiDriver
77+
* @return \Arcanedev\GeoIP\Drivers\AbstractDriver
11578
*/
11679
protected function createMaxmindApiDriver()
11780
{
@@ -126,14 +89,16 @@ protected function createMaxmindApiDriver()
12689
/**
12790
* Build the driver.
12891
*
129-
* @param string $key
92+
* @param string $name
13093
*
131-
* @return mixed
94+
* @return \Arcanedev\GeoIP\Drivers\AbstractDriver
13295
*/
133-
private function buildDriver($key)
96+
private function buildDriver($name)
13497
{
135-
$class = $this->getDriverClass($key);
98+
$class = $this->config()->get("geoip.drivers.$name.driver");
13699

137-
return new $class($this->getDriverOptions($key));
100+
return new $class(
101+
$this->config()->get("geoip.drivers.$name.options", [])
102+
);
138103
}
139104
}

src/Entities/Continents.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php namespace Arcanedev\GeoIP\Entities;
22

3-
use Arcanedev\Support\Collection;
3+
use Illuminate\Support\Collection;
44

55
/**
66
* Class Continents

tests/Drivers/MaxmindDatabaseDriverTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ private function makeDriver()
8888
private function switchDatabasePath()
8989
{
9090
$this->config()->set(
91-
'geoip.supported.maxmind-database.options.database-path',
91+
'geoip.drivers.maxmind-database.options.database-path',
9292
realpath(__DIR__ . '/../fixture/data/geoip.mmdb')
9393
);
9494
}

tests/Entities/ContinentsTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ public function it_can_be_instantiated()
4747
{
4848
$expectations = [
4949
\Illuminate\Support\Collection::class,
50-
\Arcanedev\Support\Collection::class,
5150
\Arcanedev\GeoIP\Entities\Continents::class,
5251
];
5352

0 commit comments

Comments
 (0)