Download the PHP package winavin/permissions without Composer

On this page you can find all versions of the php package winavin/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 permissions

Permissions

A lightweight, Enum-driven Roles & Permissions system for Laravel, designed to support multiple user models and multi-team setups without database-stored role and permissions definitions.

Unlike existing solutions such as santigarcor/laratrust, spatie/laravel-permission, JosephSilber/bouncer, which tightly couple roles and permissions to database entries or a single team model, this package offers a developer-first, elegant approach using modern PHP 8.1+ Enums and polymorphic teams.

Features

How It Works

Extending

Since the Enum and Model classes are published directly into your App namespace, you are free to extend them according to your needs.

Examples:

This approach gives you full control while maintaining the package's performance and simplicity.

Installation

Install the package using Composer:

Publish the configuration file:

Setup

1. Publish Configuration

2. Configure your models and teams in the config file

3. Now run install coammand to create the necessary tables and models:

`

This will create the necessary database migrations, Pivot models, and enum classes for your user models and teams.

Alternate Option

1. Publish Migration & Model Classes

Use the following command to generate the database migration and model scaffolding for a user model:

Replaces {User Model} with your model prefix (e.g. User, Customer, Employee) whichever you want to assign roles and permissions.

This will publish following files

2. Add Trait to User Models

Add the trait to your model:

3. Publish Enum Classes for Team

Use this command to create role and permission Enums for your teams.:

This will publish

4. Define Permissions

You can create new Roles and Permissions cases in Enum. After that define permissions for Role using the permissions() method inside the corresponding Role Enum.

Usage

Assigning Roles and Permissions

Checking Roles and Permissions

For readability, you may also use:

You can also check for multiple roles or permissions:

Retrieving Roles and Permissions

You can retrieve a user's assigned roles and permissions. These methods return a Laravel Collection and accept an optional $team parameter to limit results to a specific team:

Retrieving Teams

If a user belongs to any teams via roles (or direct permissions mapped through roles), you can retrieve them:

Syncing Roles and Permissions

You can sync roles or permissions to replace the current ones:

This will remove all old roles/permissions and assign the new ones.

Removing Roles and Permissions

You can remove a role or permission individually:

All related cache keys will be automatically cleared when you remove a role or permission.

Overwriting (Optional)

You can overwrite following methods in trait as per your need.

Notes

Contributing

If you want to contribute to this package, feel free to submit a pull request or open an issue on GitHub.

License

This package is open-sourced software licensed under the MIT.


All versions of permissions with dependencies

PHP Build Version
Package Version
Requires laravel/framework Version ^10.0|^11.0|^12.0|^13.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 winavin/permissions contains the following files

Loading the files please wait ...