PHPackages                             codebar-ag/laravel-feature-policy - 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. codebar-ag/laravel-feature-policy

ActiveLibrary[Security](/categories/security)

codebar-ag/laravel-feature-policy
=================================

Permissions-Policy (Feature-Policy) header builder and middleware for Laravel

v13.0.0(3mo ago)012.0k1MITPHPPHP 8.3.\*|8.4.\*|8.5.\*CI passing

Since Apr 3Pushed 1w agoCompare

[ Source](https://github.com/codebar-ag/laravel-feature-policy)[ Packagist](https://packagist.org/packages/codebar-ag/laravel-feature-policy)[ Docs](https://github.com/codebar-ag/laravel-feature-policy)[ RSS](/packages/codebar-ag-laravel-feature-policy/feed)WikiDiscussions main Synced today

READMEChangelog (1)Dependencies (16)Versions (5)Used By (1)

[![](https://camo.githubusercontent.com/525c684920a4e0eb408c6b59df889b15780b2fd753d4b7edd37b92d1b019b25a/68747470733a2f2f62616e6e6572732e6265796f6e64636f2e64652f4c61726176656c25323046656174757265253230506f6c6963792e706e673f7468656d653d6c69676874267061636b6167654d616e616765723d636f6d706f7365722b72657175697265267061636b6167654e616d653d636f64656261722d61672532466c61726176656c2d666561747572652d706f6c696379267061747465726e3d63697263756974426f617264267374796c653d7374796c655f32266465736372697074696f6e3d5065726d697373696f6e732d506f6c6963792b6865616465722b6275696c6465722b616e642b6d6964646c65776172652b666f722b4c61726176656c2e266d643d312673686f7757617465726d61726b3d3026666f6e7453697a653d313530707826696d616765733d736869656c64267769647468733d35303026686569676874733d353030)](https://camo.githubusercontent.com/525c684920a4e0eb408c6b59df889b15780b2fd753d4b7edd37b92d1b019b25a/68747470733a2f2f62616e6e6572732e6265796f6e64636f2e64652f4c61726176656c25323046656174757265253230506f6c6963792e706e673f7468656d653d6c69676874267061636b6167654d616e616765723d636f6d706f7365722b72657175697265267061636b6167654e616d653d636f64656261722d61672532466c61726176656c2d666561747572652d706f6c696379267061747465726e3d63697263756974426f617264267374796c653d7374796c655f32266465736372697074696f6e3d5065726d697373696f6e732d506f6c6963792b6865616465722b6275696c6465722b616e642b6d6964646c65776172652b666f722b4c61726176656c2e266d643d312673686f7757617465726d61726b3d3026666f6e7453697a653d313530707826696d616765733d736869656c64267769647468733d35303026686569676874733d353030)

[![Latest Version on Packagist](https://camo.githubusercontent.com/b5ca6e21fad45ca12c31c3eac8017b57c6151c6bec62dce41061722d0a501d07/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f636f64656261722d61672f6c61726176656c2d666561747572652d706f6c6963792e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/codebar-ag/laravel-feature-policy)[![Total Downloads](https://camo.githubusercontent.com/ee5aec2646cb80233e8eb0f46a3b4c7a78c3be633c249b2e2cc1e32ed9523a8d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f636f64656261722d61672f6c61726176656c2d666561747572652d706f6c6963792e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/codebar-ag/laravel-feature-policy)[![GitHub Tests](https://github.com/codebar-ag/laravel-feature-policy/actions/workflows/tests.yml/badge.svg?branch=main)](https://github.com/codebar-ag/laravel-feature-policy/actions/workflows/tests.yml)[![GitHub Code Style](https://github.com/codebar-ag/laravel-feature-policy/actions/workflows/fix-php-code-style-issues.yml/badge.svg?branch=main)](https://github.com/codebar-ag/laravel-feature-policy/actions/workflows/fix-php-code-style-issues.yml)[![PHPStan](https://github.com/codebar-ag/laravel-feature-policy/actions/workflows/phpstan.yml/badge.svg)](https://github.com/codebar-ag/laravel-feature-policy/actions/workflows/phpstan.yml)[![Dependency Review](https://github.com/codebar-ag/laravel-feature-policy/actions/workflows/dependency-review.yml/badge.svg)](https://github.com/codebar-ag/laravel-feature-policy/actions/workflows/dependency-review.yml)[![Coverage](https://github.com/codebar-ag/laravel-feature-policy/actions/workflows/coverage.yml/badge.svg?branch=main)](https://github.com/codebar-ag/laravel-feature-policy/actions/workflows/coverage.yml)

Build and apply [`Permissions-Policy`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Permissions-Policy) (formerly Feature-Policy) headers in Laravel applications.

Requirements
------------

[](#requirements)

- PHP 8.3, 8.4, or 8.5
- Laravel 13

Installation
------------

[](#installation)

```
composer require codebar-ag/laravel-feature-policy
```

Publish configuration (optional):

```
php artisan vendor:publish --tag=laravel-feature-policy-config
```

Configuration
-------------

[](#configuration)

The published config file is `config/feature-policy.php`. You can also rely on environment variables:

EnvConfig keyDefaultPurpose`FPH_ENABLED``enabled``true`Master switch; when false, middleware does not apply policy headers.—`policy``null`Fully qualified class name of your policy (must extend `CodebarAg\LaravelFeaturePolicy\Policies\Policy`).`FPH_PROPOSAL_ENABLED``directives.proposal``false`Enable [proposed](https://github.com/w3c/webappsec-permissions-policy/blob/main/features.md) directive group.`FPH_EXPERIMENTAL_ENABLED``directives.experimental``false`Enable experimental directive handling.`FPH_REPORTING_ENABLED``reporting.enabled``false`Add `Reporting-Endpoints` and related reporting metadata.`FPH_REPORT_ONLY``reporting.report_only``false`When reporting is on, also emit `Permissions-Policy-Report-Only`.`FPH_REPORTING_URL``reporting.url`*(see config)*Endpoint URL for violation reports.Implement a policy class with a `configure()` method that calls `addDirective()` (see package tests and `Policies\Policy`).

Middleware
----------

[](#middleware)

Register the middleware on your `web` stack (or another group), for example in `bootstrap/app.php`:

```
use CodebarAg\LaravelFeaturePolicy\AddFeaturePolicyHeaders;

$middleware->web(append: [
    AddFeaturePolicyHeaders::class,
]);
```

You may pass a specific policy class as a middleware parameter:

```
Route::get('/admin', AdminController::class)
    ->middleware(AddFeaturePolicyHeaders::class.':'.AdminPermissionsPolicy::class);
```

Quality checks
--------------

[](#quality-checks)

Run Laravel Pint in test mode:

```
composer lint
```

Run static analysis (PHPStan + Larastan):

```
composer analyse
```

Run the test suite:

```
composer test
```

Run tests with code coverage and a 100% minimum (requires the PCOV or Xdebug PHP extension):

```
composer test-coverage
```

Run lint, analysis, and tests together:

```
composer quality
```

Credits
-------

[](#credits)

This package was initially inspired by [mazedlx/laravel-feature-policy](https://github.com/mazedlx/laravel-feature-policy) (MIT). The implementation has since been significantly adapted for Laravel 13 and is maintained independently by [codebar-ag](https://github.com/codebar-ag).

License
-------

[](#license)

MIT

###  Health Score

48

—

FairBetter than 93% of packages

Maintenance91

Actively maintained with recent releases

Popularity25

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 Bus Factor2

2 contributors hold 50%+ of commits

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 ~564 days

Total

3

Last Release

90d ago

Major Versions

1.0.0 → v13.0.02026-04-03

PHP version history (3 changes)v1.0PHP ^8.1|^8.2

1.0.0PHP ^8.5

v13.0.0PHP 8.3.\*|8.4.\*|8.5.\*

### Community

Maintainers

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

---

Top Contributors

[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (29 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (29 commits)")[![StanBarrows](https://avatars.githubusercontent.com/u/10268813?v=4)](https://github.com/StanBarrows "StanBarrows (4 commits)")

---

Tags

laravelsecurityheadersfeature-policypermissions-policycodebar-ag

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

Type Coverage Yes

### Embed Badge

![Health badge](/badges/codebar-ag-laravel-feature-policy/health.svg)

```
[![Health](https://phpackages.com/badges/codebar-ag-laravel-feature-policy/health.svg)](https://phpackages.com/packages/codebar-ag-laravel-feature-policy)
```

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3355.3M346](/packages/psalm-plugin-laravel)[laravel/mcp

Rapidly build MCP servers for your Laravel applications.

77022.3M145](/packages/laravel-mcp)[laravel/socialite

Laravel wrapper around OAuth 1 &amp; OAuth 2 libraries.

5.7k108.5M874](/packages/laravel-socialite)[spatie/laravel-csp

Add CSP headers to the responses of a Laravel app

86611.1M25](/packages/spatie-laravel-csp)[illuminate/auth

The Illuminate Auth package.

10528.2M1.2k](/packages/illuminate-auth)[illuminate/routing

The Illuminate Routing package.

1419.2M3.0k](/packages/illuminate-routing)

PHPackages © 2026

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