Download the PHP package mabrouk/permission without Composer

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

Mabrouk/Permission

mabrouk/permission is a Laravel api package for dealing with project admins permissions using Database approach.

Table of Content

Important Introduction

Usage sequence

Installation

Configurations according to project needs

Using HasPermission Trait on desired models

Out of the box methods and attributes

Out of the box models

Out of the box routes

What else?

Models Api Resources to expect in requests response

Any thing else?

License

Important introduction

In order to get the most benefit of this package results, try to follow the standard routes naming to have a well organized permissions names suites very well with your models naming as well.

Usage sequence

After installation and modifing configuration:

Installation

You can install the package using composer.

In order to get things work, add the at the end of the property of class

After this you may accept it on any specific grouped routes like group under property in same file or use it on specific routes in your routes file as most of middlewares you used to use before.

The first option to apply it to group for example will be more comfortable during development process as you will not have to think about it anymore after configuring package configuration with your project needs.

Configurations according to project needs

Config file have several configuration options and already have enough comments to describe every key meaning and how to use.

You may access it under

After modifying config file don't forget to run below command:

Using HasPermission Trait on desired models

Now you need to add trait on models which will have roles such as "User" model for example. Don't forget to add this trait to all models you specified in config file under the key and don't forget to carefully read the instructions included in config file.

Out of the box methods and attributes

After using trait on specified models in config file as mentioned above you will have additional methods and attributes on specified models. let's take User model as example and see methods usage such as the following:

Methods

note here that User model is used just as example and you can use the same functionality with any specified models in config file after applying trait on it.

Attributes

Out of the box models

We have 4 basic models to deal with:

Out of the box routes

Let's run the command and discover our package predefined routes

Actually we will find the output of the following routes in addition to your project current routes:

Show, update and destroy routes accept model as model segment in url

If above routes is not exists you may need to clear cached routes using command

What else?

You are one step away from handling your project permissions with only running below command after adding any additional routes under specified base urls defined in config file.

Note:

You need to run below command after adding or modifying any routes related to you specified in config file in order to add or modify its suitable permissions.

Now you will find that specified in config file have full permissions.

Sub Permissions will be added depending on your routes available actions. For example if you specified actions of api resource route to allow just store and destroy for example it will affect added sub permissions accordingly, otherwise it will add the 4 actions to super admin user to play with it according to specific role he is modifying.

Models Api Resources to expect in requests response

Any thing else?

Actually one more thing to know is that this package depend on mabrouk/translatable package in order to handle translation dynamically for any chosen language.

You will need to pass additional input "locale" in update requests of mentioned models and need to create roles and permission groups with your application default language. To get role/permission/permission group name or description with desired language you need to pass additional header to your requests "X-locale"

Both "locale" and "X-locale" accept values like ['en', 'ar', 'fr', ...] etc depending on languages you support in your project.

License

Mabrouk/Permission package is open-sourced software licensed under the MIT license.


All versions of permission with dependencies

PHP Build Version
Package Version
Requires laravel/framework Version >=9
mabrouk/translatable Version >=1
mabrouk/filterable Version >=1
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 mabrouk/permission contains the following files

Loading the files please wait ....