PHPackages                             lsbproject/blacklist-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. [Utility &amp; Helpers](/categories/utility)
4. /
5. lsbproject/blacklist-bundle

AbandonedArchivedSymfony-bundle[Utility &amp; Helpers](/categories/utility)

lsbproject/blacklist-bundle
===========================

Bundle to simplify blacklist creation using annotations

001[4 PRs](https://github.com/22116/blacklist-bundle/pulls)PHP

Since Oct 8Pushed 6y ago1 watchersCompare

[ Source](https://github.com/22116/blacklist-bundle)[ Packagist](https://packagist.org/packages/lsbproject/blacklist-bundle)[ RSS](/packages/lsbproject-blacklist-bundle/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependenciesVersions (5)Used By (0)

LSBProjectBlacklistBundle
=========================

[](#lsbprojectblacklistbundle)

Flexible bundle to handle blacklist with annotations. Highly inspired by

Installation
============

[](#installation)

Applications that use Symfony Flex
----------------------------------

[](#applications-that-use-symfony-flex)

Open a command console, enter your project directory and execute:

```
$ composer require lsbproject/blacklist-bundle
```

Applications that don't use Symfony Flex
----------------------------------------

[](#applications-that-dont-use-symfony-flex)

### Step 1: Download the Bundle

[](#step-1-download-the-bundle)

Open a command console, enter your project directory and execute the following command to download the latest stable version of this bundle:

```
$ composer require lsbproject/blacklist-bundle
```

This command requires you to have Composer installed globally, as explained in the [installation chapter](https://getcomposer.org/doc/00-intro.md)of the Composer documentation.

### Step 2: Enable the Bundle

[](#step-2-enable-the-bundle)

Then, enable the bundle by adding it to the list of registered bundles in the `config/bundles.php` file of your project:

```
// config/bundles.php

return [
    // ...
    LSBProject\BlacklistBundle\LSBProjectBlacklistBundle::class => ['all' => true],
];
```

### Step 3: Update database schema

[](#step-3-update-database-schema)

```
php bin/console doctrine:schema:update --force
```

Usage
=====

[](#usage)

```
    use LSBProject\BlacklistBundle\Validator\Constraints\IsNotBlacklisted;

    //...

    /**
     * 'baz' type isn't defined in bundle, so it will be handled with
     * default_type class. Default one has no validation and will compare
     * any value with other existed
     *
     * @IsNotBlacklisted(type="baz", caseSensetive=true)
     * @var string
     */
    private $bar;

    /**
     * 'email' type will dissallow to put invalid emails in blacklist
     *
     * @IsNotBlacklisted(type="email", caseSensetive=true)
     * @var string
     */
    private $email;
```

Types
-----

[](#types)

Bundle tries to validate exact blacklist type with validator types. You can implement your own type or use default one. To add your own validator just implement `TypeInterface`

e.g.

```
use LSBProject\BlacklistBundle\Type\TypeInterface;
use LSBProject\BlacklistBundle\Type\DefaultType;

class EmailType extends DefaultType implements TypeInterface
{
    /**
     * {@inheritDoc}
     */
    public function satisfies(string $value): bool
    {
        return filter_var($value, FILTER_VALIDATE_EMAIL);
    }

    /**
     * {@inheritDoc}
     */
    public function supports(string $type): bool
    {
        return $type === 'email';
    }
}
```

and tag it with `lsbproject.blacklist.type`

```
  email_blacklist_type:
    class: 'LSBProject\BlacklistBundle\Type\EmailType'
    tags:
      - { name: 'lsbproject.blacklist.type' }
```

Default
-------

[](#default)

If there are no supported types found bundle will use default type. You can override it in config:

```
    lsb_project_blacklist:
      default_type: LSBProject\BlacklistBundle\Type\DefaultType
```

Validate storage
----------------

[](#validate-storage)

If you do not want to use database as a storage for blacklist you can implement your own `validate` method for a separate or default types.

example of default `validate`

```
class DefaultType implements TypeInterface
{
    //...

    /**
     * {@inheritDoc}
     */
    public function validate(
        string $value,
        Constraint $constraint,
        ExecutionContextInterface &$context,
        BlacklistManagerInterface $manager
    ): void {
        if ($manager->isBlacklisted($value, $constraint->type, $constraint->caseSensetive)) {
            $context->buildViolation($constraint->message)->addViolation();
        }
    }
}
```

###  Health Score

19

—

LowBetter than 10% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity1

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/0ec5f3868bec2cabf2a93e65332064b42aaa3055a31f848332b3d8a240e5834c?d=identicon)[LSBProject](/maintainers/LSBProject)

---

Top Contributors

[![fedorenko22116](https://avatars.githubusercontent.com/u/22433371?v=4)](https://github.com/fedorenko22116 "fedorenko22116 (9 commits)")

---

Tags

blacklistbundlephpsymfony

### Embed Badge

![Health badge](/badges/lsbproject-blacklist-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/lsbproject-blacklist-bundle/health.svg)](https://phpackages.com/packages/lsbproject-blacklist-bundle)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
