PHPackages                             sajjadhossainshohag/laravel-permission-scanner - 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. [Templating &amp; Views](/categories/templating)
4. /
5. sajjadhossainshohag/laravel-permission-scanner

ActiveLibrary[Templating &amp; Views](/categories/templating)

sajjadhossainshohag/laravel-permission-scanner
==============================================

Permission Scanner Tool is a scans your application for @can, @canany, and permission middleware usage in controllers, routes, and Blade views. It helps developers analyze and manage role-based access control (RBAC) by extracting all permission-related directives efficiently.

0.1.0-beta(1y ago)341MITPHPCI passing

Since Mar 17Pushed 1y ago1 watchersCompare

[ Source](https://github.com/sajjadhossainshohag/laravel-permission-scanner)[ Packagist](https://packagist.org/packages/sajjadhossainshohag/laravel-permission-scanner)[ RSS](/packages/sajjadhossainshohag-laravel-permission-scanner/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (5)Versions (2)Used By (0)

Laravel Permission Scanner
==========================

[](#laravel-permission-scanner)

The **Laravel Permission Scanner** helps you manage role-based access control in your Laravel application by scanning for the usage of `@can`, `@canany`, and permission middleware in controllers, routes, and Blade views. It provides an easy way to analyze and track permission-related directives across your app.

> Note: Laravel Permission Scanner is currently in beta version.

Features
--------

[](#features)

- Scans PHP files for `@can`, `@canany`, `middleware`, `Gate`, and permission methods
- Detects permission usage in:
    - Controllers
    - Routes
    - Blade views
    - Middleware
- Analyzes permissions using AST parsing
- Generates permission seeders automatically
- Provides detailed results of found permissions across files
- Supports debugging with detailed file and permission output

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

[](#requirements)

- PHP 8.1 or higher
- Laravel 8.0 or higher

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

[](#installation)

Install the package via Composer:

```
composer require sajjadhossainshohag/laravel-permission-scanner:v0.1.0-beta
```

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

[](#configuration)

Publish the configuration file:

```
php artisan vendor:publish --provider="Sajjadhossainshohag\LaravelPermissionScanner\PermissionScannerServiceProvider"
```

This will create a `config/scanner.php` file where you can customize the scan paths:

```
return [
    'scan_paths' => [
        'resources/views',
        'app',
        'routes',
    ],
];
```

Usage
-----

[](#usage)

### Basic Scanning

[](#basic-scanning)

Run the command to scan your application:

```
php artisan permission:scan
```

This will display all found permissions in your application.

### Generate Permission Seeder

[](#generate-permission-seeder)

To automatically generate a seeder file with found permissions:

```
php artisan permission:scan --seeder=PermissionsTableSeeder
```

This will create a new seeder file in `database/seeders` with all discovered permissions.

Example output:

```
class PermissionsTableSeeder extends Seeder
{
    public function run()
    {
        $permissions = [
            ['name' => 'edit-posts', 'guard_name' => 'web'],
            ['name' => 'delete-posts', 'guard_name' => 'web'],
            // ...
        ];

        DB::table('permissions')->insert($permissions);
    }
}
```

What It Scans For
-----------------

[](#what-it-scans-for)

The scanner detects permissions in:

1. Blade Directives:

    - `@can('permission-name')`
    - `@canany(['permission-1', 'permission-2'])`
2. Controller Methods:

    - `$this->authorize('permission-name')`
    - `Gate::allows('permission-name')`
3. Route Definitions:

    - `->middleware('can:permission-name')`
    - `->middleware('permission:permission-name')`
4. Policy Methods:

    - Permission-related method names and checks

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

[](#contributing)

Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.

1. Fork the Project
2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`)
3. Commit your Changes (`git commit -m 'Add some AmazingFeature'`)
4. Push to the Branch (`git push origin feature/AmazingFeature`)
5. Open a Pull Request

### Development

[](#development)

```
# Install dependencies
composer install

# Run tests
composer test
```

License
-------

[](#license)

This package is open-source software licensed under the [MIT license](LICENSE).

Credits
-------

[](#credits)

This package is open-source software licensed under the [MIT license](LICENSE).

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance45

Moderate activity, may be stable

Popularity8

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity23

Early-stage or recently created project

 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

422d ago

### Community

Maintainers

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

---

Top Contributors

[![sajjadhossainshohag](https://avatars.githubusercontent.com/u/63788037?v=4)](https://github.com/sajjadhossainshohag "sajjadhossainshohag (29 commits)")

---

Tags

securityauthbladeauthorizationAuditscanneraccess-controlgateRole Managementcanlaravel-permissions-extractorcanany

###  Code Quality

TestsPest

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/sajjadhossainshohag-laravel-permission-scanner/health.svg)

```
[![Health](https://phpackages.com/badges/sajjadhossainshohag-laravel-permission-scanner/health.svg)](https://phpackages.com/packages/sajjadhossainshohag-laravel-permission-scanner)
```

###  Alternatives

[hasinhayder/tyro-login

Tyro Login - Beautiful, customizable authentication views for Laravel 12 &amp; 13

2362.2k2](/packages/hasinhayder-tyro-login)[hosseinhezami/laravel-permission-manager

Advanced permission manager for Laravel.

403.3k](/packages/hosseinhezami-laravel-permission-manager)[roots/wp-blade-check

Simple Composer package that checks and displays an admin notice if your uncompiled Blade templates are publicly accessible.

161.1k](/packages/roots-wp-blade-check)

PHPackages © 2026

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