Download the PHP package stanfortonski/laravel-roles without Composer

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

Laravel-Roles

Users roles for Laravel applications. Compatible with Laravel 7.x and 8.x.

Information

This package provides you to set of middleware, migrations, directives and methods to user model which can you use for build Laravel Application wht different types of users. You can block or allow to use part of your application to for example admin or guest.

Installation

  1. First download package composer require stanfortonski/laravel-roles.
  2. Setup provider. In config/app.php add following code to bottom of providers:

  3. Setup middleware. In app/Http/Kernel.php add following code to bottom of middlewares:

  4. Use one of three traits HasRoles, HasRolesIds or HasRolesIdsAdapter in User class. Snippet: use HasRoles;, use HasRolesIds; or use HasRolesIdsAdapter;.
  5. Additonal you can publish config file roles.php. Run command: php artisan vendor:publish --provider="Stanfortonski\Laravelroles\ServiceProvider".

Usage

More about traits HasRoles, HasRolesIds or HasRolesIdsAdapter.

Middleware

If you want to determine which user can use the link. You need to use one of three middleware: roles, roles, allofroles.

Examples: (Attention you have to define admin, moderator and writer roles before! Go To Seeding example.)

  1. Only admin can access to main page.

  2. Only Admin or moderator can access to main page.

  3. Only User that have admin and writer roles (all of these) can access to main page.

Checking that user has roles

Adding roles

Removing roles

Seeding

If you want to define yours own roles run this command php artisan make:seeder RoleSeeder and next copy and paste below code to database/seeders/RoleSeeder.php.

Then run composer dump-autoload and php artisan migrate --seed.


All versions of laravel-roles with dependencies

PHP Build Version
Package Version
Requires php Version >=7.2
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 stanfortonski/laravel-roles contains the following files

Loading the files please wait ....