Download the PHP package althinect/enum-permission without Composer

On this page you can find all versions of the php package althinect/enum-permission. 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 enum-permission

Laravel Enum Permissions

Latest Version on Packagist Total Downloads

A Laravel package to easily manage Permissions with Enums and sync these permissions to your database. This package is built on top of Spatie's Laravel-Permission package, providing an enum-based approach to permission management. It's fully configured via the config file located at config/enum-permission.php.

Requirements

Installation

This package automatically installs Spatie's Laravel-Permission package as a dependency, so you don't need to require it separately.

Spatie configs

You will need to run the migrations and add the necessary configs according to the Spatie Permissions documentation

After installation, publish the configuration file:

Then run the migrations to set up all required tables including the permissions tables from Spatie and the group column added by this package:

Configuration

The configuration file will be published to config/enum-permission.php. Customize your permissions, models path, and other options there.

Configuration Options

Migrations

This package relies on the database tables created by the Spatie Laravel-Permission package and automatically adds a 'group' column to the permissions table for better organization.

When you install this package and run migrations, two things happen:

  1. The Spatie migrations create the core permission tables:

    • permissions - Stores all permissions
    • roles - Stores all roles
    • model_has_permissions - Maps permissions to users or other models
    • model_has_roles - Maps roles to users or other models
    • role_has_permissions - Maps permissions to roles
  2. This package adds its own migration to enhance the permissions table:
    • Adds a group column to the permissions table
    • Creates an index on the group column for faster queries

The group column is used when sync_permission_group is enabled in the config, allowing permissions to be organized by model name, which is especially useful for UI-based permission management systems.

Usage

Generating Permission Enums

The permission:make command generates permission enums (and policies if requested) for your models.

Syncing Permissions to Database

The permission:sync command scans for permission enums and syncs them to the database.

Using Generated Permissions

Directory Structure

After generation, your files will be organized as follows:

If your models use domain-driven structure, permission enums will follow the same structure:

Available Commands

Examples

Generated Permission Enum

Generated Policy

Permission Groups

When sync_permission_group is enabled in the config, permissions will be grouped by model name, which is helpful for UI-based permission management:

This feature uses the group column added to the permissions table by this package's migration. The permissions are grouped automatically during the sync process:

This grouping makes it easy to:

Error Handling

The package includes comprehensive error handling:

Extending the Package

You can extend the package's functionality by:

  1. Customizing the permission stubs in the config file
  2. Adding custom permission groups
  3. Creating middleware that uses the permission enums
  4. Building custom UI components for managing permissions

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This package is open-source software licensed under the MIT license.


All versions of enum-permission with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
illuminate/contracts Version ^10.0||^11.0||^12.0
spatie/laravel-package-tools Version ^1.16
spatie/laravel-permission Version ^6.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 althinect/enum-permission contains the following files

Loading the files please wait ....