PHPackages                             zakariajawas/permissions-generator - 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. [Database &amp; ORM](/categories/database)
4. /
5. zakariajawas/permissions-generator

ActiveLibrary[Database &amp; ORM](/categories/database)

zakariajawas/permissions-generator
==================================

Generate default permissions for spatie permissions package according to your models

v0.0.6(4mo ago)660MITPHPPHP &gt;=7.4

Since Nov 8Pushed 3mo ago1 watchersCompare

[ Source](https://github.com/ZakariaJawas/permissions-generator)[ Packagist](https://packagist.org/packages/zakariajawas/permissions-generator)[ RSS](/packages/zakariajawas-permissions-generator/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (6)Dependencies (1)Versions (7)Used By (0)

Permissions Generator
=====================

[](#permissions-generator)

[![](https://camo.githubusercontent.com/8e03683b07e1890faa42da55d8190a80bfbd1495fea27858f3be40eead4f5aed/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7a616b617269616a617761732f7065726d697373696f6e732d67656e657261746f722e7376673f7374796c653d666c61742d737175617265)](https://camo.githubusercontent.com/8e03683b07e1890faa42da55d8190a80bfbd1495fea27858f3be40eead4f5aed/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7a616b617269616a617761732f7065726d697373696f6e732d67656e657261746f722e7376673f7374796c653d666c61742d737175617265) [![](https://camo.githubusercontent.com/c0e68a5e33b5acc6165a845d9448c0094c3ce70eb393f365f1e3a3adb06672d5/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f6e65757230746f78696e652f706f636b2e7376673f6c6f676f3d706870266c6f676f436f6c6f723d7768697465267374796c653d666c61742d737175617265)](https://camo.githubusercontent.com/c0e68a5e33b5acc6165a845d9448c0094c3ce70eb393f365f1e3a3adb06672d5/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f6e65757230746f78696e652f706f636b2e7376673f6c6f676f3d706870266c6f676f436f6c6f723d7768697465267374796c653d666c61742d737175617265) [![Licence](https://camo.githubusercontent.com/6d78f4cd6af359d65d19761570182ab6ab3251de81ee51fc6a8b9ea3445b913a/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f5a616b617269614a617761732f7065726d697373696f6e732d67656e657261746f72)](https://camo.githubusercontent.com/6d78f4cd6af359d65d19761570182ab6ab3251de81ee51fc6a8b9ea3445b913a/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f5a616b617269614a617761732f7065726d697373696f6e732d67656e657261746f72) [![Stars](https://camo.githubusercontent.com/6fe90b0938080be94f6155270f7e77e9982cdf1741f5e186a76356f443b11986/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f5a616b617269614a617761732f7065726d697373696f6e732d67656e657261746f72)](https://camo.githubusercontent.com/6fe90b0938080be94f6155270f7e77e9982cdf1741f5e186a76356f443b11986/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f5a616b617269614a617761732f7065726d697373696f6e732d67656e657261746f72)

Generate basic permissions for spatie permissions package for all your models at once using one artisan command.

This package contains a `GeneratePermissionsProvider` that you can use in your packages to easily register the config file and the artisan command.

What It Does
------------

[](#what-it-does)

If you are using spatie permissions package, you need to create permissions for roles manually, common permissions for all models are access (list), create, edit and delete

This package will create all the basic permissions for all models using only one artisan command.

```
php artisan permissions:generate
```

If you have the following models \[Category, Product\] as example, after running the generate command, the following rows will be inserted in your permissions table

```
list category
create category
edit category
delete category

list product
create product
edit product
delete product

```

Note: You can modify some values inside the config file, check **Working with config file** section below.

Getting started
---------------

[](#getting-started)

### Installation

[](#installation)

```
composer require zakariajawas/permissions-generator
```

You should publish the config/permissionsgenerator.php config file with:

```
php artisan vendor:publish --provider="ZakariaJawas\PermissionsGenerator\Providers\GeneratePermissionsProvider"
```

### Working with config file

[](#working-with-config-file)

In config/permissionsgenerator.php file you can modify the following values.

- Modify this value to add, update or delete a permission.

These are the basic permissions.

```
'permissions' => ['list', 'create', 'edit', 'delete']
```

For example to add **access** permission and change **edit** to **update** you can do this.

```
'permissions' => ['access', 'list', 'create', 'update', 'delete']
```

- By default the package will generate the permissions for all project models, you might want to exclude specific one or more models so you can do this.

```
'exclude' => [
App\Models\Session::class, //no permissions generated for Session model
],
```

- If you have static permissions which are not related to models for example export to pdf or access all data or maybe a page which doesn't have a model you can add these permisisons in $staticPermissions array

```
'staticPermissions' => ['export pdf', 'access dashboard']
```

Note:-

1. You have to add the full model class path.
2. You don't have to exclude other packages models, this package won't create permissions for them.

- Default permissions name is `permission + model name`, if you want to add a prefix you can specify it here.

```
'prefix' => 'can',
```

Result will be `can create product` instead of `create product`

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

Author
------

[](#author)

Zakaria Jawas [@zakariajawas](https://twitter.com/zakariajawas)

Getting help
------------

[](#getting-help)

If you spot a problem you can open an issue on the Github page, or alternatively, you can contact me via `jawas.zakaria@gmail.com`

Support the library by posting in [![Twitter](https://camo.githubusercontent.com/2c1d4639748d33f46dbdf969e5793bbabfe139320c9a63f80f56d534b2caba0f/68747470733a2f2f696d672e736869656c64732e696f2f747769747465722f75726c3f75726c3d68747470732533412532462532466769746875622e636f6d2532465a616b617269614a617761732532467065726d697373696f6e732d67656e657261746f72253246)](https://camo.githubusercontent.com/2c1d4639748d33f46dbdf969e5793bbabfe139320c9a63f80f56d534b2caba0f/68747470733a2f2f696d672e736869656c64732e696f2f747769747465722f75726c3f75726c3d68747470732533412532462532466769746875622e636f6d2532465a616b617269614a617761732532467065726d697373696f6e732d67656e657261746f72253246)

If you enjoy it, please make this library better 👍

###  Health Score

38

—

LowBetter than 85% of packages

Maintenance79

Regular maintenance activity

Popularity16

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity40

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

Every ~231 days

Recently: every ~288 days

Total

6

Last Release

127d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/148e78be67366f56c1a4c0e2bdf88a801045c9313b5ab0cf0421798621fcec4d?d=identicon)[jawas.zakaria](/maintainers/jawas.zakaria)

---

Top Contributors

[![ZakariaJawas](https://avatars.githubusercontent.com/u/10713125?v=4)](https://github.com/ZakariaJawas "ZakariaJawas (18 commits)")

---

Tags

phplaraveldatabasegeneratorpermissions

### Embed Badge

![Health badge](/badges/zakariajawas-permissions-generator/health.svg)

```
[![Health](https://phpackages.com/badges/zakariajawas-permissions-generator/health.svg)](https://phpackages.com/packages/zakariajawas-permissions-generator)
```

###  Alternatives

[laravel-doctrine/acl

ACL for Laravel and Doctrine

44445.3k7](/packages/laravel-doctrine-acl)[renoki-co/l1

Laravel integration for Cloudflare Workers services.

16113.1k](/packages/renoki-co-l1)[wayofdev/laravel-cycle-orm-adapter

🔥 A Laravel adapter for CycleORM, providing seamless integration of the Cycle DataMapper ORM for advanced database handling and object mapping in PHP applications.

3516.7k3](/packages/wayofdev-laravel-cycle-orm-adapter)[tomatophp/filament-locations

Database Seeds for Countries / Cities / Areas / Languages / Currancy with ready to use resources for FilamentPHP

2320.8k6](/packages/tomatophp-filament-locations)

PHPackages © 2026

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