Download the PHP package iamgerwin/nova-spatie-role-permission without Composer

On this page you can find all versions of the php package iamgerwin/nova-spatie-role-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 nova-spatie-role-permission

Laravel Nova Spatie Role Permission

Latest Version on Packagist GitHub Tests Action Status Total Downloads

A comprehensive Laravel Nova tool for managing roles and permissions with Spatie's Laravel Permission package. Built for Laravel 11-12, Nova 5, and PHP 8.3+.

Features

Requirements

Installation

Step 1: Install the package

Install the package via composer:

Step 2: Publish Configuration (Optional but Recommended)

The package includes default configuration, but you can publish it for customization:

Step 3: Clear Caches

After installation, clear all caches to ensure proper loading:

Step 4: Set up Spatie Permissions

Publish and run the migrations from Spatie Laravel Permission if you haven't already:

Step 5: Register the Tool

Register the tool in your NovaServiceProvider:

Note: Laravel Nova must be installed and configured in your application before using this package's features.

Quick Setup (Alternative)

For a faster setup, use the installation command which handles most of the above steps:

This command will:

You can also use command options for non-interactive installation:

Configuration

Publish the configuration file to customize the package:

This will create config/nova-permission.php where you can customize:

Usage

Verify Installation

After installation, verify everything is properly configured:

This command will check:

Adding Roles and Permissions to User Resource

You can add role and permission fields to your User Nova resource in multiple ways:

Using MorphToMany Field (Recommended)

Using Boolean Group Fields

For a checkbox-style interface:

Using Select Field for Single Role

Advanced Configuration

Custom Resources

You can use your own Nova resources:

Custom Policies

Define your own authorization policies:

Guard Configuration

Specify custom guards for roles and permissions:

Middleware

The package includes automatic permission cache clearing. To enable it, add the middleware to your Nova middleware group:

Bulk Actions

The package includes a bulk action to attach permissions to roles:

Localization

The package supports internationalization. Publish the language files:

Available languages:

You can add your own translations in the resources/lang/vendor/nova-spatie-role-permission directory.

Authorization

As of version 1.1.0, the package includes secure default policies that check for actual permissions. The policies support granular permissions and a super admin role that bypasses all checks.

Default Permission Structure

The package's policies check for these permissions:

Role Management Permissions

Permission Management Permissions

Super Admin Role

Custom Authorization Policies

To override the default policies with your own logic:

  1. Create custom policy classes:

  2. Register your custom policies with the tool:

Testing

Development

Code Quality

Run code formatting:

Run static analysis:

Note: Static analysis excludes Nova-dependent files since Nova is not available during package development. These files are fully functional when Nova is installed in your application.

Troubleshooting

Common Issues and Solutions

"Class name must be a valid object or a string" Error

This error occurs when the configuration file is not properly loaded. Solutions:

  1. Publish the configuration file (if not using defaults):

  2. Clear all caches:

Package Not Working After Installation

If the package isn't working after installation:

Missing Permissions or Roles

If permissions or roles aren't showing up:

  1. Check if migrations have been run:

  2. Clear the permission cache:

  3. Verify your models are configured correctly:

Authorization Not Working

If users can't access roles/permissions despite having the right permissions:

  1. Ensure the user has the correct permissions:

  2. Clear permission cache:

  3. Check if super-admin role is configured:

Verification Command

Use the verification command to diagnose installation issues:

This command checks:

Getting Help

If you're still experiencing issues:

  1. Run the verification command and include the output in your issue report
  2. Check the GitHub Issues
  3. Review the CHANGELOG for recent changes
  4. Ensure you're using compatible versions (see Requirements section)

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

This package is based on the original work by vyuldashev/nova-permission and has been updated and enhanced for modern Laravel, Nova, and PHP versions.

License

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


All versions of nova-spatie-role-permission with dependencies

PHP Build Version
Package Version
Requires php Version ^8.3
laravel/framework Version ^11.0||^12.0
spatie/laravel-permission Version ^6.0
spatie/laravel-package-tools Version ^1.16
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 iamgerwin/nova-spatie-role-permission contains the following files

Loading the files please wait ...