PHPackages                             processdrive/rap - 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. processdrive/rap

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

processdrive/rap
================

Laravel roles and permission simple package

239CSS

Since Mar 29Pushed 4y ago1 watchersCompare

[ Source](https://github.com/antony382/roles-and-permission)[ Packagist](https://packagist.org/packages/processdrive/rap)[ RSS](/packages/processdrive-rap/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependenciesVersions (1)Used By (0)

[![Latest Stable Version](https://camo.githubusercontent.com/25eefd9e55dfa0a8f8e203162459d7700f9a51c0cf158f505af7d1ecc76ecdec/68747470733a2f2f706f7365722e707567782e6f72672f6c61726176656c2f6c61726176656c2f762f737461626c65)](https://camo.githubusercontent.com/25eefd9e55dfa0a8f8e203162459d7700f9a51c0cf158f505af7d1ecc76ecdec/68747470733a2f2f706f7365722e707567782e6f72672f6c61726176656c2f6c61726176656c2f762f737461626c65) [![Latest Unstable Version](https://camo.githubusercontent.com/22388f695a8e81b6f639173dd9203a7af7aa926d1af8ff49e4d5a91f55940d10/68747470733a2f2f706f7365722e707567782e6f72672f6c61726176656c2f6c61726176656c2f762f756e737461626c65)](https://packagist.org/packages/laravel/laravel) [![License](https://camo.githubusercontent.com/4fe03af169d521f7dc79459741eae96cae976c0186f5e8e758174e710383b9d6/68747470733a2f2f706f7365722e707567782e6f72672f6c61726176656c2f6c61726176656c2f6c6963656e7365)](https://packagist.org/packages/laravel/laravel)

Roles And Permission (RAP)
==========================

[](#roles-and-permission-rap)

A simple package to assign RAP(Roles And Permission) for an application.

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

[](#installation)

Via composer

```
composer require "processdrive/rap":"dev-master"

```

Or set in composer.json

```
"require": {
    "processdrive/rap":"dev-master"
}

```

Register Dependencies
---------------------

[](#register-dependencies)

Set configuration in `config/app.php`

```
// Set providers.
'providers' => [
    Collective\Html\HtmlServiceProvider::class,
    processdrive\rap\RAPServiceProvider::class,
]

// Set aliases
'aliases' => [
    'Form' => 'Collective\Html\FormFacade',
    'Html' => 'Collective\Html\HtmlFacade',
    'RAPHelper' => processdrive\rap\app\Helpers\RAPHelper::class,
],

```

Set relationship in `app/User.php`

```
/**
 * @return @return \Illuminate\Database\Eloquent\Relations\belongsToMany
 */
public function roles() {
    return $this->belongsToMany("App\Models\Role","user_role", "user_id", "role_id");
}

/**
 * [hasPermission]
 * @param  [str]  $permission
 * @return boolean
 */
public function hasPermission($permission) {
    return $this->roles()->get()[0]->hasPermission($permission);
}

```

Publish the package
-------------------

[](#publish-the-package)

```
php artisan vendor:publish --all

```

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

[](#configuration)

Set configuration in `config/rap/rap_config.php`

```
return [

    // Set Route access enable or disable
    'use_package_routes' => true,

    // Set middlewares
    'middlewares' => ['auth', 'CheckRole'],

    // Set Static Action
    'static_action' => [
        'index' => 'List',
        'create' => 'Create',
        'show' => 'Show',
        'edit' => 'Edit',
        'destroy' => 'Destroy',
        'store' => 'Store',
        'update' => 'Update',
        'delete' => 'Delete'
    ],

    //Set Omit Action it will be womited from permission module.
    'omit_action' => []
];

```

Run command
-----------

[](#run-command)

```
composer dump-autoload

```

Run migration
-------------

[](#run-migration)

```
php artisan migrate

```

Generate translation and DB seed
--------------------------------

[](#generate-translation-and-db-seed)

```
php artisan rap_generate:translation

```

Edit translation files
----------------------

[](#edit-translation-files)

```
resources/lang/en/rap_actions.php
resources/lang/en/rap_modules.php

```

Add Route
---------

[](#add-route)

Add Route in `routes/web.php`

```
Route::group(['middleware' => 'CheckRole'], function () {
    //add routes which are going to validate by RAP.
});

RAPHelper::routes();

```

Add ifream in your application
------------------------------

[](#add-ifream-in-your-application)

Add ifream in your application

```

```

Register Middelware
-------------------

[](#register-middelware)

register in your `app/Http/kernel.php`

```
protected $routeMiddleware = [
    'CheckRole' => processdrive\rap\app\Http\Middleware\CheckRole::class,
];

```

Usage
-----

[](#usage)

```
@hasPermission("viewSettings")
    // your code
@endHasPermission

```

###  Health Score

17

—

LowBetter than 6% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community5

Small or concentrated contributor base

Maturity26

Early-stage or recently created project

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.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/33420753?v=4)[Jaikumar M](/maintainers/robertantonyjaikumar)[@robertantonyjaikumar](https://github.com/robertantonyjaikumar)

![](https://www.gravatar.com/avatar/9b8afeb311b0b71904df1a95d8e68de9c78da0759c6f72cb849b0aab28956892?d=identicon)[antony382](/maintainers/antony382)

---

Tags

laravellaravel-packagepermissionsphpraproles

### Embed Badge

![Health badge](/badges/processdrive-rap/health.svg)

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

###  Alternatives

[namshi/jose

JSON Object Signing and Encryption library for PHP.

1.8k99.6M101](/packages/namshi-jose)[league/oauth1-client

OAuth 1.0 Client Library

99698.8M106](/packages/league-oauth1-client)[bezhansalleh/filament-shield

Filament support for `spatie/laravel-permission`.

2.8k2.9M88](/packages/bezhansalleh-filament-shield)[gesdinet/jwt-refresh-token-bundle

Implements a refresh token system over Json Web Tokens in Symfony

70516.4M35](/packages/gesdinet-jwt-refresh-token-bundle)[league/oauth2-google

Google OAuth 2.0 Client Provider for The PHP League OAuth2-Client

41721.2M118](/packages/league-oauth2-google)[illuminate/auth

The Illuminate Auth package.

9327.3M1.0k](/packages/illuminate-auth)

PHPackages © 2026

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