Download the PHP package lcloss/simple-permission without Composer

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

SimplePermission

SimplePermission is a simple authorization package for Laravel. It is designed with Laravel 10, but may work with other versions. With this package, Roles and Permissions are added to your Laravel application, so you can easily manage authorization.

Installation

  1. Install the package via composer:

  2. Publish the config file:

  3. Compile assets:

  4. Run the migrations:

  5. Add the HasRoles trait to your User model:

  6. Add the AuthGates middleware to your app\Http\Kernel.php file:

  7. Add the role to the user If you are using Laravel Fortify, you can chane App\Actions\Fortify\CreateNewUser.php file:

    With the configuration above, the first user created will be a sysadmin, and the others will be user.

  8. Other considerations

Check package blade files. You can use your own blade files by replacing the blade file names in config/simple-permission.php file. Do not forget to:

a) Add @liwewireStyles() and @livewireScripts() to your layout file. b) Add @yield('scripts') to your layout file. c) Add @yield('modals') to the end of body, on the layout file.

Configuration

You can change this package's configuration by editing the config/simple-permission.php file.

Database Seeder

This package comes with a database seeder that creates the default roles and permissions. You can run it with the following command:

Or, you can run individual seeders:

Roles and Permissions

Roles

This package cames with default roles: 'sysadmin', 'admin', 'premium-user', 'user' and 'free-user'.

Each role has a single identification slug and a level to determine the role's hierarchy. Roles with level 1 are the highest level roles, and roles with level 300 are the lowest level roles. All roles with level 1 get access to all permissions.

You can customize the roles by editing the database\seeders\SimplePermissionRoleSeeder.php file.

Permissions

Permissions follows the structure of access, list and CRUD operations (create, read, update and delete). Tipically access permisison is used to allow access to a resource, list permission is used to allow listing the resource, and CRUD permissions are used to allow operations on the resource.

A permission is composed by an object and an action, delimited by a _ character. An object is a resource, like users, roles, permissions, posts or comments. An action is an operation on the resource, like access, list, create, read, update or delete.

So, the permission users_create determine if the user can create users, and the permission users_list determine if the user can list users.

You can customize the permissions by editing the database\seeders\SimplePermissionPermissionSeeder.php file.

To protect a route, you can use the can middleware:

To protect a controller method, you can use the can middleware:

To protect a part of a view, you can use the @can directive:

TODOs


All versions of simple-permission with dependencies

PHP Build Version
Package Version
Requires livewire/livewire Version v2.12.6
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 lcloss/simple-permission contains the following files

Loading the files please wait ....