2017 © Pedro Peláez
 

symfony-bundle blacklist-bundle

Provides a Blacklist system for Symfony using Annotations with Sonata admin integration.

image

antoinelemaire/blacklist-bundle

Provides a Blacklist system for Symfony using Annotations with Sonata admin integration.

  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 150 % Grown

The README.md

AntoineLemaireBlacklistBundle

Blacklist system with integration in Symfony. Just insert blacklist value/type combinaison inside database and use Annotation to assert., (*1)

Example Database, (*2)

Installation

Add the package to your composer.json file, (*3)

"antoinelemaire/blacklist-bundle": "dev-master",

Add this to app/AppKernel.php, (*4)

<?php
    public function registerBundles()
    {
        $bundles = array(
            ...
            new AntoineLemaire\BlacklistBundle\AntoineLemaireBlacklistBundle(),
        );

        ...

        return $bundles;
    }

Configuration

Sonata admin:

sonata_admin:
    dashboard:
        groups:
            antoinelemaire_blacklist:
                label: Blacklist
                label_catalogue: AntoineLemaireBlacklistBundle
                items:
                    - AntoineLemaire\BlacklistBundle\Admin\BlacklistAdmin

Usage

Available types: - email - email_domain (when 'email=true' is defined, apply the constraint only on the domain part of the value) - ip, (*5)

class User
{
    /**
     * @var string

     * @IsNotBlacklisted(type="email")
     * @IsNotBlacklisted(type="email_domain", email=true)
     */
    private $email;

    /**
     * @var string

     * @IsNotBlacklisted(type="ip", message="This IP is blacklisted.")
     */
    private $ip;

}

The Versions