Download the PHP package coffeecodemx/wildcard-permissions without Composer

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

Laravel Wildcard Permission

License Latest Stable Version Total Downloads Build Status

A powerful permission management library for Laravel applications.

Features

Installation

You can install this package via Composer. Run the following command:

Then add the service provider in your Laravel project

Next you need to publish the configuration and migration files with the following command

Now you'll see a new configuration file in /config directory, just do the changes needed for table names and classes. A recommended change for a basic usage is to change under pivot_names.model_id to you model id which usually is user_id

Now run the migrations

Add the traits to the model you wish to have permissions

That's it!

Usage and examples

Create new Permission

To create a new permission you just need to run the following command.

Short name and description are very descriptive, however guard_name is the special one, this field will only accepts alphabetic upper and lowecase and : symbol to separate namespaces, modules, you name it!

You can combine multiple namespaces like this:

Find Permission

Since guard name is unique, you can easyly find a permission using guard name or if you want to find it using other fields just check the following examples.

Assign direct permissions to a Model

First your model should have the Trait HasPermissions, then is just

And if you want to revoke a permission is using the following

Create new Role

Roles are basically a collection of permissions and the way to create a new one is using the following command

Now for assigning or revoking permissions is the same as we do with models

or revoking permissions

Assigning roles to a user

First your model should have the Trait HasRoles, then is just

or you can unassign it

Check if your user has one or more roles

If you want to check for roles you have 3 operations

Check if the user has permissions

For checking permissions you can search by permission object, by guard_name or by wildcard

Middlewares

This package comes with RoleMiddleware, PermissionMiddleware and RoleOrPermissionMiddleware middleware. You can add them inside your app/Http/Kernel.php file to be able to use them through aliases.

Middleware via Routes

You can protect your routes using middleware rules:

Use middleware static methods

For a better usage and to avoid confusion between laravel convetion using colon : to separate the alias from the parameters and since the guard_names are using the same character for namespaces, alternatively you can use this syntax.


All versions of wildcard-permissions with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
illuminate/auth Version ^8.12|^9.0|^10.0|^11.0
illuminate/container Version ^8.12|^9.0|^10.0|^11.0
illuminate/contracts Version ^8.12|^9.0|^10.0|^11.0
illuminate/database Version ^8.12|^9.0|^10.0|^11.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 coffeecodemx/wildcard-permissions contains the following files

Loading the files please wait ....