PHPackages                             azine/geoblocking-bundle - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Security](/categories/security)
4. /
5. azine/geoblocking-bundle

ActiveSymfony-bundle[Security](/categories/security)

azine/geoblocking-bundle
========================

Bundle to filter/geoblock the access of visitors to your pages by location

2.0.0(9y ago)42.4k3MITPHPPHP &gt;=5.3.2

Since Feb 3Pushed 9y ago1 watchersCompare

[ Source](https://github.com/azine/geoblocking-bundle)[ Packagist](https://packagist.org/packages/azine/geoblocking-bundle)[ Docs](https://github.com/azine/geoblocking-bundle)[ RSS](/packages/azine-geoblocking-bundle/feed)WikiDiscussions master Synced 3w ago

READMEChangelogDependencies (3)Versions (6)Used By (0)

Simple GeoBlocking-Bundle
=========================

[](#simple-geoblocking-bundle)

Symfony2 Bundle that allows you to configure geoblocking access to certain pages of your application.

It adds an kernel event listener that listens for "kernel.request" events and uses the php geoip module to identify the country of origin of the current request and depending on the configuration displays an error-page.

Requirements
------------

[](#requirements)

There are no explicit requirements. BUT the default setup makes two assumptions:

##### 1. the php geoip-module is enabled on your server or you installed and configured the Maxmind/GeoIP Bundle

[](#1-the-php-geoip-module-is-enabled-on-your-server-or-you-installed-and-configured-the-maxmindgeoip-bundle)

"DefaultLookupAdapter" uses the [php function geoip\_country\_code\_by\_name($address)](http://www.php.net/manual/en/function.geoip-country-code3-by-name.php)to find the country of the given address.

To use the default implementation, this function (provided by the php geoip module =&gt; ) must be available.

Alternatively you can use the MaxmindLookupAdapter (from the Maxmind/GeoIP-Bundle =&gt; "maxmind/geoip": "dev-master"), which requires that the MaxmindGeoIPBundle is installed and configured.

Or you can implement and use your own GeoLookupAdapter that uses an other way to find the country for the given ip (see below).

##### 2. you use fosuserbundle for authentication/usermanagment

[](#2-you-use-fosuserbundle-for-authenticationusermanagment)

Most often you would like that registered users can access your site from wherever they are. So there should be a option to login and for logged in users no pages should be blocked. As a lot of people (including me) use the fosuserbundle for user managment, the default configuration is set to work nicely with the default configuration of the fosuserbundle.

You can change this of course in the config.yml.

Installation
------------

[](#installation)

To install AzineGeoBlockingBundle with Composer just add the following to your composer.json file:

```
// composer.json
{
    // ...
    require: {
        // ...
        "azine/geoblocking-bundle": "dev-master"
    }
}

```

Then, you can install the new dependencies by running Composer’s update command from the directory where your composer.json file is located:

```
php composer.phar update

```

Now, Composer will automatically download all required files, and install them for you. All that is left to do is to update your AppKernel.php file, and register the new bundle:

```
