Download the PHP package riteshjha/laravel-permission without Composer

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

Laravel Permission (Account and Owner Level Check)

Latest Version on Packagist Total Downloads

This package allows you to manage user permissions in a database using role and direct user based permission with Account (Organization) level and owner level permission check. It handle 2 types of abilities (route ability and field ability).

Installation

  1. Require it with Composer

  2. You can publish the migrations, views, assets and the config file with:

  3. Add the service provider in your config/app.php file:

  4. This package publishes a file. Check this file and change accourding to your needs for different (Ability, Role and User) model name and other config options.

  5. Run migrations:

Configuration

  1. First configure models namesapce in

  2. Add trait to your User model and to Role model.

  3. All model that you want to include in permission should implements interface and add trait.

Ability

Package handle 2 types of ability (route ability and field ability). Package parse Auth route (route which has auth middleware) and store route name as a Route Ability. For field ability, you have to define it in your model like this:

class Project extends Model
{
    protected $fieldAbilities = ['cost', 'estimated_cost'] ; //list projects table fields on which you want to apply permission
}

You can use in your seeder to alow default field ability. For details check in tests.

Role and Ability Group

Role and Ability is divided in 2 groups (SYSTEM and ACCOUNT). All admin users that mange admin tasks will under SYSTEM group role. All users that signup or login as front end user will under ACCOUNT group. Similarly All ability (route name) which is used for admin interface will be under SYSTEM group and all ability which is used for front-end will be under ACCOUNT group. To disable it change to true in config.

Sync Ability

php artisan ability:record  // if need fresh then add --fresh

Admin Interface

There is an admin interface with routes and views for handling ability and permissions. You have to add package routes in your admin route group.

Route::group(['middleware' => ['auth'], 'prefix' => 'admin'], function () {
    Permission::routes();
});

Now you can access permission interface via routes

Note: If you use admin routes prefix other than 'admin' then change value in

Usage

Package use laravel gate, so you can use in view and in controller for route ability. And for field ability in view. Here projects is a table name.

For Details check Tests

Create/Update

When creating or updating record in model then filter data using method like :

$data = Project::filterFieldAccess($data)

All versions of laravel-permission with dependencies

PHP Build Version
Package Version
Requires php Version ^7.3|^8.0
laravel/framework Version ^8.0|^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 riteshjha/laravel-permission contains the following files

Loading the files please wait ....