Download the PHP package saeedvir/laravel-permissions without Composer

On this page you can find all versions of the php package saeedvir/laravel-permissions. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-permissions

Latest Version Total Downloads License

Laravel Permissions Package

A highly optimized role and permission package for Laravel 11/12 with advanced features including multiple guards, wildcard permissions, super admin, expirable permissions, expirable roles, and Laravel Gate integration.

✨ Features

Core Features

Advanced Features

Performance

Developer Experience

Requirements

Quick Start

Installation

Step 1: Install via Composer

Install the package via Composer:

The package will automatically register its service provider.

Step 2: Publish Configuration

Publish the configuration file:

Step 3: Configure Database

Update your .env file:

Step 4: Configure Database Connection

Update config/permissions.php to set your database connection properly.

Step 5: Run Migrations

Or publish and customize migrations first:

Setup

Add Trait to User Model

Add the HasRolesAndPermissions trait to your User model:

Usage

Creating Roles and Permissions

Assigning Permissions to Roles

Assigning Roles to Users

Giving Direct Permissions to Users

Checking Roles and Permissions

Using Blade Directives (Optional - needs implementation)

Advanced Features

Expirable Roles (NEW in v2.1.0)

Assign roles with expiration dates for temporary access:

Enable Feature

In config/permissions.php or .env:

Or in .env:

Usage Examples

How it works:

Expirable Permissions

Similar to expirable roles, you can set expiration on direct permissions:

Enable Feature

Usage Examples

Wildcard Permissions

Use wildcards for flexible permission matching:

Enable Feature

Usage Examples

Super Admin Role

Designate a role that automatically has all permissions:

Enable Feature

Usage

Query Scopes

Powerful query scopes for filtering users:

Middleware Usage

The package provides three middlewares:

1. CheckAuth Middleware

Checks if user is authenticated:

2. CheckRole Middleware

Checks if user has specific role(s):

3. CheckPermission Middleware

Checks if user has specific permission(s):

Combining Middlewares

Configuration

Cache Settings

Control caching behavior in config/permissions.php:

Middleware Responses

Configure unauthorized/unauthenticated responses:

Performance Settings

Cache Management

Manual Cache Clearing

Automatic Cache Clearing

The package automatically clears relevant caches when:

Database Structure

Tables Created

  1. roles - Stores role definitions
  2. permissions - Stores permission definitions
  3. role_has_permissions - Pivot table for role-permission relationships
  4. model_has_roles - Polymorphic pivot table for user-role relationships
  5. model_has_permissions - Polymorphic pivot table for user-permission relationships

Performance Optimization Tips

  1. Enable Caching: Set PERMISSION_CACHE_ENABLED=true in .env
  2. Use Eager Loading: The package uses eager loading when checking permissions from roles
  3. Database Indexing: All tables have proper indexes for fast queries
  4. Use Slugs: Always use slugs (strings) instead of IDs for better cache utilization
  5. Chunk Large Operations: Use the configured chunk size for batch operations

Testing

Security

If you discover any security-related issues, please email [email protected] instead of using the issue tracker.

License

The MIT License (MIT). Please see License File for more information.

Credits

Support

For support, please open an issue on GitHub or contact [email protected]


All versions of laravel-permissions with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
illuminate/support Version ^11.0|^12.0
illuminate/database Version ^11.0|^12.0
illuminate/cache Version ^11.0|^12.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package saeedvir/laravel-permissions contains the following files

Loading the files please wait ...