Download the PHP package cuongnd88/lara-guardian without Composer

On this page you can find all versions of the php package cuongnd88/lara-guardian. 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 lara-guardian

Laravel Guardian

Laravel Guardian makes it easy to perform permission

1-Install cuongnd88/lara-repository using Composer.

2-Add the following service provider in config/app.php

3-Run make:guardian command

App/Traits provides QueryKit trait to empower Laravel models.

App/Guardian/Traits has a trait to support Laravel Guardian.

App/Http/Middlewares/GuardianMiddleware.php is to check user's permissions.

App/Models provides 5 models such as Action, Role, Group, Permission, Role.

database/migrations has 5 tables: actions, roles, groups, permissions, roles.

Sample Usage

Based on route's name, Lara Guardian checks user's permission. You must follow the rule in naming a route: $page.$action

You have to assign the guard middleware in your app/Http/Kernel.php file.

There is the relationship of Guardian's models

MEMO: the alias of actions, pages tables is used to name a route, therefore you need to enter lower-case letters, dash symbol instead of space.

Please add App\Guardian\Traits\HasGuardian.php into the model

The HasGuardian trait provides:

joinGroup($groupId) : user joins a group.

joinMultiGroups($groups) : user joins multi groups.

hasPermissions(array $where = [], string $action = null, array $select = []) : show user's permissions.

rightAccess(string $page = null, string $action = null) : check user has the permission to access.

Import/Export data

Currently, Lara Guardian imports array data (read files in config\guardian) into database, and exports data in DB to file by using simple command

--action= is import or export value.

model= is one or three values actions|pages|groups.

For example:

App\Traits\QueryKit.php support these useful methods in importing/exporting guardian data:

insertDuplicate(array $data, array $insertKeys, array $updateKeys) is insert new rows or update existed rows. The first argument consists of the values to insert or update, while second argument lists the column(s) that uniquely identify records within the associated table. The third argument is an array of the columns that should be updated if a matching record already exists in the database.

except(array $columns) is to retrieve a subset of the output data.


All versions of lara-guardian with dependencies

PHP Build Version
Package Version
Requires php Version ^7.2.5|^8.0
cuongnd88/lara-query-kit Version ^1.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 cuongnd88/lara-guardian contains the following files

Loading the files please wait ....