PHPackages                             switon/authz - 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. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. switon/authz

ActiveLibrary[Authentication &amp; Authorization](/categories/authentication)

switon/authz
============

Authorization and policy enforcement for Switon Framework

v1.0.0(1mo ago)042MITPHPPHP &gt;=8.3CI passing

Since May 10Pushed 2d agoCompare

[ Source](https://github.com/switon-php/authz)[ Packagist](https://packagist.org/packages/switon/authz)[ Docs](https://github.com/switon-php/authz)[ RSS](/packages/switon-authz/feed)WikiDiscussions main Synced 1w ago

READMEChangelogDependencies (6)Versions (2)Used By (2)

Switon Authz Package
====================

[](#switon-authz-package)

[![CI](https://camo.githubusercontent.com/49eeb4a7b459d17933c07da1d5a9cff8fbadaec29273e7b7c6e6b521910b2fb7/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f737769746f6e2d7068702f617574687a2f63692e796d6c3f6272616e63683d6d61696e266c6162656c3d4349)](https://github.com/switon-php/authz/actions/workflows/ci.yml) [![PHP 8.3+](https://camo.githubusercontent.com/c03f51341eebaefabbf137e291b20523fc74b4ffd084406d88524d266d95085d/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e332532422d373737424234)](https://www.php.net/)

Switon's HTTP authorization layer for controller and action policies, identity states, and voter-based access control.

Highlights
----------

[](#highlights)

- **Attribute-based access rules:** `#[Authorize]` lets controllers and actions declare policy in place.
- **Layered defaults:** class-level rules set the baseline, and method rules can override them.
- **Policy aliases:** `@edit`-style references stay tied to their targets.
- **Decision hooks:** `VoterInterface` can grant, deny, or abstain before the default check runs.
- **Identity states:** authenticated, anonymous, and superuser access are handled explicitly.

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

[](#installation)

```
composer require switon/authz
```

Quick Start
-----------

[](#quick-start)

```
use Switon\Authorizing\Attribute\Authorize;

#[Authorize(Authorize::AUTHENTICATED)]
class UserController
{
    public function indexAction(): void
    {
    }

    public function profileAction(): void
    {
    }

    #[Authorize(Authorize::ANONYMOUS)]
    public function publicAction(): void
    {
    }

    #[Authorize('@index')]
    public function deleteAction(): void
    {
    }
}
```

Docs:

License
-------

[](#license)

MIT.

###  Health Score

42

—

FairBetter than 88% of packages

Maintenance97

Actively maintained with recent releases

Popularity5

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity48

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

30d ago

### Community

Maintainers

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

---

Top Contributors

[![switon-php](https://avatars.githubusercontent.com/u/247358032?v=4)](https://github.com/switon-php "switon-php (1 commits)")

---

Tags

authorizationpoliciesrbacswitonauthorizationrbacpoliciesswiton

### Embed Badge

![Health badge](/badges/switon-authz/health.svg)

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

###  Alternatives

[santigarcor/laratrust

This package provides a flexible way to add Role-based Permissions to Laravel

2.3k5.6M46](/packages/santigarcor-laratrust)[casbin/casbin

a powerful and efficient open-source access control library for php projects.

1.3k1.5M55](/packages/casbin-casbin)[casbin/laravel-authz

An authorization library that supports access control models like ACL, RBAC, ABAC in Laravel.

331361.0k4](/packages/casbin-laravel-authz)[pktharindu/nova-permissions

Laravel Nova Grouped Permissions (ACL)

136409.8k](/packages/pktharindu-nova-permissions)[laminas/laminas-permissions-rbac

Provides a role-based access control management

363.6M32](/packages/laminas-laminas-permissions-rbac)[silvanite/novatoolpermissions

Laravel Nova Permissions (Roles and Permission based Access Control (ACL))

100262.7k2](/packages/silvanite-novatoolpermissions)

PHPackages © 2026

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