2017 © Pedro Peláez
 

symfony-bundle sypex-geo-bundle

An adaptation of Sypex Geo library to Symfony2

image

yamilovs/sypex-geo-bundle

An adaptation of Sypex Geo library to Symfony2

  • Monday, March 13, 2017
  • by yamilovs
  • Repository
  • 2 Watchers
  • 6 Stars
  • 16,013 Installations
  • PHP
  • 2 Dependents
  • 0 Suggesters
  • 1 Forks
  • 1 Open issues
  • 5 Versions
  • 11 % Grown

The README.md

Build Status, (*1)

SypexGeoBundle

This is an adaptation of Sypex Geo Library for Symfony., (*2)

Installation

Step 1: Download SypexGeoBundle using composer

Add SypexGeoBundle by running the command:, (*3)

$ composer require yamilovs/sypex-geo-bundle:^2.0

Step 2: Enable the bundle

Enable the bundle in the kernel:, (*4)

<?php
// app/AppKernel.php

public function registerBundles()
{
    $bundles = array(
        // ...
        new Yamilovs\Bundle\SypexGeoBundle\SypexGeoBundle(),
    );
}

Step 3: Add some configurations

# app/config/config.yml

yamilovs_sypex_geo:
    mode: FILE # FILE (default) | BATCH | MEMORY
    database_path: "%kernel.root_dir%/../var/SypexGeoDatabase/SxGeoCity.dat"

If you need the proxy configuration for database update, you can add:, (*5)

yamilovs_sypex_geo:
    ......
    connection:
        proxy:
            host: 'xxx.xxx.xxx.xxx'
            port: # port number

            # You can enable user credentials if you have them
            auth:
                user: 'your username'
                password: 'your password'

Step 4: Download necessary databases

Download necessary databases to database_path. - You can run php bin/console yamilovs:sypex-geo:update-database-file - Or download it manually from Sypex Geo City, (*6)

Usage

In your controller

<?php
// src/Controller/FooController.php
namespace App\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;
use Yamilovs\SypexGeo\SypexGeo;

class FooController extends Controller
{
    public function fooAction(Request $request, SypexGeo $sypexGeo)
    {
        $userIp = $request->getClientIp();
        $testIp = '88.86.218.24';

        $city = $sypexGeo->getCity($testIp, true);

        dump($city);
    }
}

Note:, (*7)

Your local ip address is 127.0.0.1 and Sypex Geo cant get your city or country!, (*8)

If you want to check data from specific IP address

You can run php bin/console yamilovs:sypex-geo:get-ip-data aa.bb.cc.dd, (*9)

The Versions

13/03 2017

dev-master

9999999-dev https://github.com/yamilovs/SypexGeoBundle

An adaptation of Sypex Geo library to Symfony2

  Sources   Download

MIT

The Requires

  • php >=5.5.9
  • ext-zip *

 

The Development Requires

by Yamilov Stepan

geo location

07/03 2017

1.2.1

1.2.1.0 https://github.com/yamilovs/SypexGeoBundle

An adaptation of Sypex Geo library to Symfony2

  Sources   Download

MIT

The Requires

  • php >=5.5.9
  • ext-zip *

 

The Development Requires

by Yamilov Stepan

geo location

07/12 2016

1.2.0

1.2.0.0 https://github.com/yamilovs/SypexGeoBundle

An adaptation of Sypex Geo library to Symfony2

  Sources   Download

MIT

The Requires

  • php >=5.5.9
  • ext-zip *

 

The Development Requires

by Yamilov Stepan

geo location

06/12 2016

1.1.0

1.1.0.0 https://github.com/yamilovs/SypexGeoBundle

An adaptation of Sypex Geo library to Symfony2

  Sources   Download

MIT

The Requires

 

The Development Requires

by Yamilov Stepan

geo location

15/06 2015

1.0.0

1.0.0.0 https://github.com/yamilovs/SypexGeoBundle

An adaptation of Sypex Geo library to Symfony2

  Sources   Download

MIT

The Requires

  • php >=5.2.7

 

by Yamilov Stepan

geo location