Skip to content

Commit 9841217

Browse files
committed
updated for laravel 5
1 parent 4111484 commit 9841217

File tree

4 files changed

+24
-15
lines changed

4 files changed

+24
-15
lines changed

README.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
GeoIP
22
=============
33

4-
> Geoip Wrapper with Laravel Support
4+
> Geoip Wrapper with Laravel 4 & 5 Support
55
6-
[![Build Status](http://img.shields.io/travis/pulkitjalan/geoip/1.0.svg?style=flat-square)](https://travis-ci.org/pulkitjalan/geoip)
7-
[![Scrutinizer Code Quality](http://img.shields.io/scrutinizer/g/pulkitjalan/geoip/1.0.svg?style=flat-square)](https://scrutinizer-ci.com/g/pulkitjalan/geoip/)
8-
[![Coverage Status](https://img.shields.io/scrutinizer/coverage/g/pulkitjalan/geoip/1.0.svg?style=flat-square)](https://scrutinizer-ci.com/g/pulkitjalan/geoip/code-structure/1.0)
6+
[![Build Status](http://img.shields.io/travis/pulkitjalan/geoip/master.svg?style=flat-square)](https://travis-ci.org/pulkitjalan/geoip)
7+
[![Scrutinizer Code Quality](http://img.shields.io/scrutinizer/g/pulkitjalan/geoip/master.svg?style=flat-square)](https://scrutinizer-ci.com/g/pulkitjalan/geoip/)
8+
[![Coverage Status](https://img.shields.io/scrutinizer/coverage/g/pulkitjalan/geoip/master.svg?style=flat-square)](https://scrutinizer-ci.com/g/pulkitjalan/geoip/code-structure/master)
99
[![License](http://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](http://www.opensource.org/licenses/MIT)
1010
[![Latest Version](http://img.shields.io/packagist/v/pulkitjalan/geoip.svg?style=flat-square)](https://packagist.org/packages/pulkitjalan/geoip)
1111
[![Total Downloads](https://img.shields.io/packagist/dt/pulkitjalan/geoip.svg?style=flat-square)](https://packagist.org/packages/pulkitjalan/geoip)
@@ -26,7 +26,7 @@ Install via composer - edit your `composer.json` to require the package.
2626

2727
```js
2828
"require": {
29-
"pulkitjalan/geoip": "1.*"
29+
"pulkitjalan/geoip": "2.*"
3030
}
3131
```
3232

@@ -48,11 +48,11 @@ Next add the following to the `aliases` array in your `config/app.php`
4848
'GeoIP' => 'PulkitJalan\GeoIP\Facades\GeoIP'
4949
```
5050

51-
Next run `php artisan config:publish pulkitjalan/geoip` to publish the config file.
51+
Next run `php artisan vendor:publish --provider="pulkitjalan\geoip\GeoIPServiceProvider" --tag="config"` to publish the config file.
5252

53-
#### Looking for a Laravel 5 compatible version?
53+
#### Looking for a Laravel 4 compatible version?
5454

55-
Checkout the [master branch](https://github.com/pulkitjalan/geoip/tree/master)
55+
Checkout the [1.0 branch](https://github.com/pulkitjalan/geoip/tree/1.0)
5656

5757
## Usage
5858

@@ -130,7 +130,7 @@ $config = [
130130

131131
### Laravel
132132

133-
To use this package in Laravel, simply update the config file in `config/packages/pulkitjalan/geoip/config.php` to get the same effect.
133+
To use this package in Laravel, simply update the config file in `config/geoip.php` to get the same effect. The driver can be set using the `GEOIP_DRIVER` env.
134134

135135
### Available Methods
136136

composer.json

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
],
1212
"require": {
1313
"php": ">=5.4.0",
14-
"illuminate/support": "~4",
15-
"illuminate/console": "~4",
14+
"illuminate/support": "~5",
15+
"illuminate/console": "~5",
1616
"pulkitjalan/requester": "1.*",
1717
"geoip2/geoip2": "2.*"
1818
},
@@ -27,5 +27,10 @@
2727
"files": [
2828
"helpers.php"
2929
]
30+
},
31+
"extra": {
32+
"branch-alias": {
33+
"dev-master": "2.0.x-dev"
34+
}
3035
}
3136
}

src/GeoIPServiceProvider.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ public function boot()
2222
$this->app['PulkitJalan\GeoIP\GeoIP'] = function ($app) {
2323
return $app['geoip'];
2424
};
25+
26+
$this->publishes([
27+
__DIR__.'/config/config.php' => config_path('geoip.php'),
28+
], 'config');
2529
}
2630

2731
/**
@@ -31,7 +35,7 @@ public function boot()
3135
*/
3236
public function register()
3337
{
34-
$this->app->config->package('pulkitjalan/geoip', realpath(__DIR__.'/config'), 'geoip');
38+
$this->mergeConfigFrom(__DIR__.'/config/config.php', 'geoip');
3539

3640
$this->registerGeoIP();
3741

@@ -46,7 +50,7 @@ public function register()
4650
protected function registerGeoIP()
4751
{
4852
$this->app['geoip'] = $this->app->share(function ($app) {
49-
return new GeoIP($app->config->get('geoip::config'));
53+
return new GeoIP(config('geoip'));
5054
});
5155
}
5256

@@ -58,7 +62,7 @@ protected function registerGeoIP()
5862
protected function registerUpdateCommand()
5963
{
6064
$this->app['command.geoip.update'] = $this->app->share(function ($app) {
61-
return new UpdateCommand($app->config->get('geoip::config'));
65+
return new UpdateCommand(config('geoip'));
6266
});
6367

6468
$this->commands(['command.geoip.update']);

src/config/config.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
| Supported: "ip-api", "telize", "maxmind"
1010
|
1111
*/
12-
'driver' => 'ip-api',
12+
'driver' => env(GEOIP_DRIVER, 'ip-api'),
1313

1414
/*
1515
|--------------------------------------------------------------------------

0 commit comments

Comments
 (0)