PHPackages                             ctors/pledge-symfony-routing - 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. ctors/pledge-symfony-routing

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

ctors/pledge-symfony-routing
============================

Adds OpenBSD pledge/unveil support to Symfony routing

1.0.0(2y ago)26ISCPHPPHP &gt;=8.2.0

Since Nov 22Pushed 2y ago1 watchersCompare

[ Source](https://github.com/tvlooy/PledgeSymfonyRouting)[ Packagist](https://packagist.org/packages/ctors/pledge-symfony-routing)[ RSS](/packages/ctors-pledge-symfony-routing/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (2)Versions (2)Used By (0)

Symfony pledge/unveil routing support
=====================================

[](#symfony-pledgeunveil-routing-support)

This bundle adds PHP attributes `#[Pledge]` and `#[Unveil]` so you can add these to your routes. It's possible to add these attributes to your route class, or method and it is possible to add multiple of them.

Installing
----------

[](#installing)

```
composer require ctors/pledge-symfony-routing

```

The bundle requires ext/pledge, which is available as an OpenBSD port and package. See [pecl-pledge](https://github.com/tvlooy/php-pledge/#openbsd-installation) for installation instructions.

```
cd /usr/ports/www/pecl-pledge
env FLAVOR="php82" make install

pkg_add pecl82-pledge-2.1.0

```

Using
-----

[](#using)

```
#[Unveil('/', 'r')]
#[Unveil('/htdocs/var/log', 'rwc')]
#[Unveil('/htdocs/var/cache', 'rwc')]
class DnsLookupController extends AbstractController
{
    #[Route('/hello', name: 'hello')]
    #[Unveil] // Disallow future unveil calls
    #[Pledge('stdio rpath wpath cpath fattr flock')]
    public function index(): Response
    {
        return $this->render('hello/index.html.twig');
    }
}

```

If you want to write in an additional directory you can modify it like this:

```
#[Unveil('/', 'r')]
#[Unveil('/htdocs/var/log', 'rwc')]
#[Unveil('/htdocs/var/cache', 'rwc')]
class DnsLookupController extends AbstractController
{
    #[Route('/hello', name: 'hello')]
    #[Unveil('/htdocs/src/Controller', 'rwc')]
    #[Unveil] // Disallow future unveil calls
    #[Pledge('stdio rpath wpath cpath fattr flock')]
    public function index(): Response
    {
        file_put_contents(__DIR__.'/test', 'ohai');

        return $this->render('hello/index.html.twig');
    }
}

```

If you want to connect to a MariaDB database over TCP/IP, add the `inet` pledge:

```
#[Unveil('/', 'r')]
#[Unveil('/htdocs/var/log', 'rwc')]
#[Unveil('/htdocs/var/cache', 'rwc')]
class DnsLookupController extends AbstractController
{
    public function __construct(
        private UserRepository $userRepository,
    ) {
    }

    #[Route('/hello', name: 'hello')]
    #[Unveil] // Disallow future unveil calls
    #[Pledge('stdio rpath wpath cpath fattr flock inet')]
    public function index(): Response
    {
        return $this->render(
            'hello/index.html.twig',
            [
                'users' => $this->userRepository->findAll(),
            ]
        );
    }
}

```

See [pecl-pledge](https://github.com/tvlooy/php-pledge/#fpm-configuration) for configuring this on an FPM pool level.

Notes
-----

[](#notes)

Make sure to set PHP-FPM `pm.max_requests = 1` so you don't reuse a pledged/unveiled process.

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity55

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.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

899d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/57f44cb52273c29c230dbd1e9ef080402d53eaebcdd1fafbf5c6b75527b40199?d=identicon)[tvlooy](/maintainers/tvlooy)

---

Top Contributors

[![tvlooy](https://avatars.githubusercontent.com/u/391674?v=4)](https://github.com/tvlooy "tvlooy (1 commits)")

---

Tags

symfonysecurityopenbsd

### Embed Badge

![Health badge](/badges/ctors-pledge-symfony-routing/health.svg)

```
[![Health](https://phpackages.com/badges/ctors-pledge-symfony-routing/health.svg)](https://phpackages.com/packages/ctors-pledge-symfony-routing)
```

###  Alternatives

[tilleuls/url-signer-bundle

Create and validate signed URLs with a limited lifetime in Symfony

81340.1k](/packages/tilleuls-url-signer-bundle)[scheb/2fa

Two-factor authentication for Symfony applications (please use scheb/2fa-bundle to install)

578630.7k1](/packages/scheb-2fa)[dneustadt/csrf-cookie-bundle

CSRF protection cookie for use with XHR

1379.2k1](/packages/dneustadt-csrf-cookie-bundle)

PHPackages © 2026

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