Download the PHP package itstructure/laravel-rbac without Composer

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

Laravel RBAC package

Latest Stable Version Latest Unstable Version License Total Downloads Build Status Scrutinizer Code Quality

1 Introduction

LaRbac - Package for the Laravel framework which provides management with the next data:

RBAC package structure

2 Dependencies

3 Installation

Note!

Version 3.x is for laravel 8+, 9+, 10+, 11+.

Version 2.x is for laravel 6 or 7. You can use branch laravel67-rbac with 2.x versions.

3.1 General installation from remote repository

Run the composer command:

composer require itstructure/laravel-rbac "^3.0.15"

3.2 Next internal installation steps

Notes:

Recommendation:

If you don't have any layout yet, it is useful to install for example AdminLTE or you can make your special any layout template. Cause in this package there is no a layout specially. But in config it is necessary to set it (see the next point 2 about a configure).

Let's go:

  1. Publish files.

    Note: rbac.php config file and seeders LaRbacDatabaseSeeder, PermissionSeeder, RoleSeeder must be published surely!

    • To publish config run command:

      php artisan rbac:publish --only=config

      It stores config file to config folder.

    • To publish seeders run command:

      php artisan rbac:publish --only=seeders

      It stores seeder files to database/seeders folder.

    • To publish migrations run command:

      php artisan rbac:publish --only=migrations

      It stores migration files to database/migrations folder.

    • To publish views run command:

      php artisan rbac:publish --only=views

      It stores view files to resources/views/vendor/rbac folder.

    • To publish translations run command:

      php artisan rbac:publish --only=lang

      It stores translation files to resources/lang/vendor/rbac folder.

    • To publish all parts run command without only argument:

      php artisan rbac:publish

    Else you can use --force argument to rewrite already published files.

  2. Configure published config/rbac.php file:

    • set layout. Example: 'layout' => 'adminlte::page'

    • change userModelClass if it is needed to change

    • set adminUserId which you wanted to be with the role of administrator. At least at the beginning stage.

      It is necessary for the next time system to let you go into the Rbac control panel, after you assigned an administrator role for you (Later see point 4).

    • Most likely you have to change memberNameAttributeKey.

      It is to display the user name in control panel by getMemberNameAttribute() method of Administrable trait. It can be string or a callback:

  3. Run command to run migrations and seeders:

    php artisan rbac:database

    Or optional:

    To run just migrations php artisan rbac:database --only=migrate

    To run just seeds php artisan rbac:database --only=seed

    • Alternative variant for seeders.

      You can set published rbac LaRbacDatabaseSeeder seeder class in to a special DatabaseSeeder:

      and run command: php artisan db:seed.

  4. Run command to set Admin role for user with identifier adminUserId, defined in 2 point:

    php artisan rbac:admin

4 Usage

Notes:

4.1 Model part

According with the Itstructure\LaRbac\Interfaces\RbacUserInterface use functions from Itstructure\LaRbac\Traits\Administrable trait as in example:

4.2 Routes part

There are already integrated base RBAC routes to manage users, roles and permissions. See in routes.php package file.

They are guarded by the next:

This routes allow you to go to the next routes:

4.3 Gates part

There are already integrated base RBAC gates to access control in your application to some of the resources. See provider file RbacAuthServiceProvider.php.

It provides the next gate definitions:

Read more in Laravel gates

5 View examples

Users

RBAC package structure

Roles

RBAC package structure

Permissions

RBAC package structure

License

Copyright © 2018-2024 Andrey Girnik [email protected].

Licensed under the MIT license. See LICENSE.txt for details.


All versions of laravel-rbac with dependencies

PHP Build Version
Package Version
Requires laravel/framework Version ^8.0|^9.0|^10.0|^11.0
php Version >=7.3.0
itstructure/laravel-grid-view Version ^1.1.4
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 itstructure/laravel-rbac contains the following files

Loading the files please wait ....