gerardtoko/blacklist-bundle 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

gerardtoko/blacklist-bundle

Composer 安装命令:

composer require gerardtoko/blacklist-bundle

包简介

Symfony 2 bundle for the Black list IP in your application

README 文档

README

Symfony2 bundle for the Black list IP in your application

Installation

Download GTBlackListBundle using composer

Add GTBlackListBundle in your composer.json:

{
    "require": {
        "gerardtoko/blacklist-bundle": "dev-master"
    }
}

Now tell composer to download the bundle by running the command:

$ php composer.phar update gerardtoko/blacklist-bundle

Composer will install the bundle to your project's vendor/gerardtoko/blacklist-bundle directory.

Register the bundle

You must register the bundle in your kernel:

    <?php
    
    // app/AppKernel.php    
    public function registerBundles()
    {
        $bundles = array(    
            // ...    
             new GT\BlackListBundle\GTBlackListBundle(),
        );    
        // ...
    }

Configuration

Select Provider Array

Example of configuration yml file:

gt_black_list:
    provider: array
    data: ["145.34.89.123", "145.34.134.23"]

Select Provider Class

The provider class must implement InterfaceBlackListProvider. The InterfaceBlackListProvider require the getData method for receive the data.

The getData Method must be returned a array.

Example of configuration yml file:

gt_black_list:
    provider: class
    class: Acme\DemoBundle\Provider\BlackListProvider

Example of the provider class:

<?php

namespace Acme\DemoBundle\Provider;

use GT\BlackListBundle\Provider\InterfaceBlackListPorvider;
use Symfony\Component\DependencyInjection\ContainerInterface;

/**
 *
 * @package AcmeDemoBundle
 * @author  Gerard Toko <gerard.toko@gmail.com>
 */
class BlackListProvider implements InterfaceBlackListPorvider
{

    protected $container;

    /**
     * 
     * @param \Symfony\Component\DependencyInjection\ContainerInterface $container
     */
    public function __construct(ContainerInterface $container)
    {
		$this->container = $container;
    }

    /**
     * 
     * @return type
     */
    public function getData()
    {
		//put your code here
		//the data can come of doctrine, propel etc...
		return array("145.34.89.123", "145.34.134.23");
    }

}

统计信息

  • 总下载量: 35
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 7
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 7
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2013-01-09