PHPackages                             silksh/security-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. silksh/security-bundle

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

silksh/security-bundle
======================

Security related extensions for Symfony

v1.0.3(6y ago)02.9kproprietaryPHP

Since Jun 21Pushed 6y ago5 watchersCompare

[ Source](https://github.com/SilkSoftwareHouse/security-bundle)[ Packagist](https://packagist.org/packages/silksh/security-bundle)[ Docs](https://github.com/SilkSoftwareHouse/security-bundle)[ RSS](/packages/silksh-security-bundle/feed)WikiDiscussions master Synced 4d ago

READMEChangelogDependencies (4)Versions (5)Used By (0)

This bundle requires **Symfony 3** or **Symfony 4**.

### Bundle installation

[](#bundle-installation)

Add the bundle to you project dependencies:

```
composer require silksh/security-bundle
```

**Symfony 3**. Enable the bundle:

```
// app/AppKernel.php
class AppKernel extends Kernel
{
    public function registerBundles()
    {
        return array(
            // ...
            new SilkSH\SecurityBundle\SilkshSecurityBundle(),
        );
    }
}
```

**Symfony 4**. It's automatic, but if Symfony did not do it for you, enable the bundle manually in `bundles.php`:

```
// config/bundles.php
return [
    // ...
    SilkSH\SecurityBundle\SilkshSecurityBundle::class => ['all' => true],
]
```

### Validators

[](#validators)

The bundle provides some Validators in the namespace `SilkSH\SecurityBundle\Validator\Constraints`.

- `FileName` validates filenames. Possible properties:

    - `maxFilenameLength`, default: 100.
    - `maxFilenameLengthMessage`: custom length error message. You can use `{{ max_length }}` inside.
    - `allowedExtensions`, default: "pdf", "txt", "doc", "docx", "ppt", "pptx", "jpg", "jpeg", "png"
    - `allowedExtensionsMessage`, custom error message about wrong extension. You can use `{{ extension }}` and `{{ extensions }}` inside.

    Example:

    ```
      use SilkSH\SecurityBundle\Validator\Constraints as SecurityAssert;

      ...

      /**
       * @Vich\UploadableField(mapping="uploads", fileNameProperty="filename")
       * @SecurityAssert\FileName(
       *     maxFilenameLength=8,
       *     maxFilenameLengthMessage="Maximal file length is {{ max_length }} characters",
       *     allowedExtensions={"zip","bz2"},
       *     allowedExtensionsMessage="Extension '{{ extension }}' is not allowed. Allowed extensions: {{ extensions }}"
       * )
       */
      private $file;
    ```
- `Name` allows only international alphanumeric and some special characters (A-z 0-9 - + \_ . , @ " '). Possible properties:

    - `message`: custom error message. You can use `{{ allowed_signs }}` inside.
- `HTMLPurifier` allows only whitelisted HTML tags and attributes. It uses [HTML Purifier](http://htmlpurifier.org/) library. Possible properties:

    - `message`: custom error message.
- `TagWhitelist`: simple and buggy HTML tag validator that uses `DOMDocument`. Using `HTMLPurifier` instead is recommended. Possible properties:

    - `allowedTags`, default: "html", "head", "meta", "title", "style", "body", "table", "tr", "th", "td", "h1", "h2", "h3", "h4", "h5", "h6", "p", "a", "img", "br", "span", "small".
    - `allowedTagsMessage`, custom error message for non valid tags. You can use `{{ allowed_tags }}` inside.
    - `allowedAttributes`, default: "width", "align", "cellspacing", "cellpadding", "class", "style", "href", "http-equiv", "name", "alt", "border", "content", "bgcolor", "type", "target", "src".
    - `allowedAttributesMessage`, custom error message for non valid attributes. You can use `{{ allowed_attributes }}` inside.

### Twig extension

[](#twig-extension)

The bundle provides `purify` filter for Twig. It uses [HTML Purifier](http://htmlpurifier.org/) to remove all unsafe tags (like ``) and attributes (like `onclick`) from HTML code.

Let's say we have some HTML code in the variable `value` and we want to render it unescaped, so that the user sees formatted output. Usage:

```
{{ value|purify|raw }}
```

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity17

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity66

Established project with proven stability

 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.

###  Release Activity

Cadence

Every ~202 days

Total

4

Last Release

2279d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/1fda4bc4e7aca770e40074c5edd8742f80f7905e106b485a02ebede0af36cf66?d=identicon)[michal.czarnecki](/maintainers/michal.czarnecki)

![](https://www.gravatar.com/avatar/3741a3be7cf31135c1f7099c507ee6087e010a31ae8eb712676c80e2deb02951?d=identicon)[tomasz.balsys](/maintainers/tomasz.balsys)

---

Top Contributors

[![michas-eu](https://avatars.githubusercontent.com/u/391821?v=4)](https://github.com/michas-eu "michas-eu (2 commits)")

### Embed Badge

![Health badge](/badges/silksh-security-bundle/health.svg)

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

###  Alternatives

[shopware/platform

The Shopware e-commerce core

3.3k1.5M3](/packages/shopware-platform)[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.4k5.6M651](/packages/sylius-sylius)[prestashop/prestashop

PrestaShop is an Open Source e-commerce platform, committed to providing the best shopping cart experience for both merchants and customers.

9.0k15.4k](/packages/prestashop-prestashop)[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.3M152](/packages/sulu-sulu)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

595.2M386](/packages/shopware-core)[contao/core-bundle

Contao Open Source CMS

1231.6M2.4k](/packages/contao-core-bundle)

PHPackages © 2026

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