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

Abandoned → [symplify/symfony-security](/?search=symplify%2Fsymfony-security)Library[Security](/categories/security)

symnedi/security
================

Voters and Firewall features from Symfony\\Security integration to Nette.

v0.3.0(9y ago)85.5k[1 issues](https://github.com/deprecated-packages/Security/issues)MITPHPPHP ^7.0

Since May 18Pushed 9y ago3 watchersCompare

[ Source](https://github.com/deprecated-packages/Security)[ Packagist](https://packagist.org/packages/symnedi/security)[ RSS](/packages/symnedi-security/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (13)Versions (12)Used By (0)

Symnedi/Security
================

[](#symnedisecurity)

[![Build Status](https://camo.githubusercontent.com/99406a8e78d96e5642c8090be0f6486937279389b0c117707327d5a9acd0ff97/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f53796d6e6564692f53656375726974792e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/Symnedi/Security)[![Quality Score](https://camo.githubusercontent.com/dd8b7ffce3061e1eb5c747b0775d2adcc11183204380bb97acdf54d065835eb3/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f53796d6e6564692f53656375726974792e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/Symnedi/Security)[![Code Coverage](https://camo.githubusercontent.com/d0c8eecb960e9eb9806c4041225b1b731a55e78457318ecdc8c8dfdcb682d6d7/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f53796d6e6564692f53656375726974792e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/Symnedi/Security)[![Downloads](https://camo.githubusercontent.com/357c635fecfe1822a9c1c352038cf067d234d31796e74cdf765ad8576695e16a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f73796d6e6564692f73656375726974792e7376673f7374796c653d666c61742d737175617265)](https://camo.githubusercontent.com/357c635fecfe1822a9c1c352038cf067d234d31796e74cdf765ad8576695e16a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f73796d6e6564692f73656375726974792e7376673f7374796c653d666c61742d737175617265)[![Latest stable](https://camo.githubusercontent.com/8ecccdada6fa5a7e320224e80dfae9b60110950d63329fab86856e08e71c12b7/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f73796d6e6564692f73656375726974792e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/symnedi/security)

Install
-------

[](#install)

```
composer require symnedi/security
```

Register the extension:

```
# app/config/config.neon
extensions:
	- Symnedi\Security\DI\SecurityExtension
	- Symnedi\EventDispatcher\DI\EventDispatcherExtension
```

Usage
-----

[](#usage)

### Voters

[](#voters)

First, [read Symfony cookbook](http://symfony.com/doc/current/cookbook/security/voters_data_permission.html)

Then create new voter implementing `Symfony\Component\Security\Core\Authorization\Voter\VoterInterface`and register it as service in `config.neon`:

```
services:
	- App\SomeModule\Security\Voter\MyVoter
```

Then in place, where we need to validate access, we'll just use `AuthorizationChecker`:

```
use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface;

class Presenter
{

	/**
	 * @var AuthorizationCheckerInterface
	 */
	private $authorizationChecker;

	public function __construct(AuthorizationCheckerInterface $authorizationChecker)
	{
		$this->authorizationChecker = $authorizationChecker;
	}

	/**
	 * @param PresenterComponentReflection $element
	 */
	public function checkRequirements($element)
	{
		if ($this->authorizationChecker->isGranted('access', $element) === FALSE) {
			throw new ForbiddenRequestException;
		}
	}

}
```

### Firewalls

[](#firewalls)

Original [Symfony firewalls](http://symfony.com/doc/current/components/security/firewall.html) pretty simplified and with modular support by default.

All we need to create is a **matcher** and a **listener**.

#### Request Matcher

[](#request-matcher)

This service will match all sites in admin module - urls starting with `/admin`:

```
use Symfony\Component\HttpFoundation\Request;
use Symnedi\Security\Contract\HttpFoundation\RequestMatcherInterface;

class AdminRequestMatcher implements RequestMatcherInterface
{

	/**
	 * {@inheritdoc}
	 */
	public function getFirewallName()
	{
		return 'adminSecurity';
	}

	/**
	 * {@inheritdoc}
	 */
	public function matches(Request $request)
	{
		$url = $request->getPathInfo();
		return strpos($url, '/admin') === 0;
	}

}
```

### Firewall Listener

[](#firewall-listener)

It will ensure that user is logged in and has 'admin' role, otherwise redirect.

```
use Nette\Application\AbortException;
use Nette\Application\Application;
use Nette\Application\Request;
use Nette\Security\User;
use Symnedi\Security\Contract\Http\FirewallListenerInterface;

class LoggedAdminFirewallListener implements FirewallListenerInterface
{

	/**
	 * @var User
	 */
	private $user;

	public function __construct(User $user)
	{
		$this->user = $user;
	}

	/**
	 * {@inheritdoc}
	 */
	public function getFirewallName()
	{
		return 'adminSecurity';
	}

	/**
	 * {@inheritdoc}
	 */
	public function handle(Application $application, Request $applicationRequest)
	{
		if ( ! $this->user->isLoggedIn()) {
			throw new AbortException;
		}

		if ( ! $this->user->isInRole('admin')) {
			throw new AbortException;
		}
	}

}
```

Then we register both services.

```
services:
	- AdminRequestMatcher
	- LoggedAdminFirewallListener
```

That's it!

Testing
-------

[](#testing)

```
composer check-cs # see "scripts" section of composer.json for more details
vendor/bin/phpunit
```

Contributing
------------

[](#contributing)

Rules are simple:

- new feature needs tests
- all tests must pass
- 1 feature per PR

We would be happy to merge your feature then!

###  Health Score

29

—

LowBetter than 59% of packages

Maintenance18

Infrequent updates — may be unmaintained

Popularity23

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 92% 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 ~56 days

Recently: every ~136 days

Total

11

Last Release

3455d ago

PHP version history (3 changes)v0.0.1PHP &gt;=5.5

v0.1.3PHP &gt;=5.6

v0.3.0PHP ^7.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/ac6d98091d07a41ebf65cf8496d73e14297ada4031f998d68a2ab30e6ef8a883?d=identicon)[enumag](/maintainers/enumag)

---

Top Contributors

[![TomasVotruba](https://avatars.githubusercontent.com/u/924196?v=4)](https://github.com/TomasVotruba "TomasVotruba (69 commits)")[![enumag](https://avatars.githubusercontent.com/u/539462?v=4)](https://github.com/enumag "enumag (6 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[symfony/security-csrf

Symfony Security Component - CSRF Library

1.8k175.4M312](/packages/symfony-security-csrf)[symfony/security-bundle

Provides a tight integration of the Security component into the Symfony full-stack framework

2.5k172.9M1.8k](/packages/symfony-security-bundle)[sylius/sylius

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

8.4k5.6M651](/packages/sylius-sylius)[nelmio/security-bundle

Extra security-related features for Symfony: signed/encrypted cookies, HTTPS/SSL/HSTS handling, cookie session storage, ...

68112.8M27](/packages/nelmio-security-bundle)[gesdinet/jwt-refresh-token-bundle

Implements a refresh token system over Json Web Tokens in Symfony

70516.4M35](/packages/gesdinet-jwt-refresh-token-bundle)[symfony/security-acl

Symfony Security Component - ACL (Access Control List)

37739.5M83](/packages/symfony-security-acl)

PHPackages © 2026

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