Download the PHP package bubobox/guard without Composer

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

Guard Circle CI

Fine grained permission checking library built with REST resources in mind.

Install

Developing

Unit test and code quality checks are all integrated into the composer test script, please run the following command before checking anything in, CircleCI will run the same tests to check your code.

Usage

There are two ways to use the library. Either with a Guard instance or by turning your own classes (e.g. the class you use for the currently active user) into locks by implementing the LockInterface on them.

Guard

A guard object can be used to setup and check rules on your resources.

A Guard option can be created by calling its constructor with the new keyword or using the class' static makemethod. Both approaches take one optional parameter. This optional parameter is the caller (generic name for user, apikey, ...) associated with this Guard instance. Callers must implement the CallerInterface interface. At this point in time, the caller is only used to pass to your assertion methods.

Allows cascade down, so calling allow('read') will tell the Guard that the read action is allowed on every resource and every property of those resources. The

Denies are only useful when you have already allowed something. Say you call allow('read') and afterwards deny('read', 'foo'). Now Guard will allow the read action on every resource except foo. They also cascade down, when you deny access to an action, it will effect all resources. Denies always supersede allows, once you deny something it does not matter if you allow it again afterwards.

You can add your own custom check by adding an assertion callable to the allow call. See assertions for more information.

can will return true or false, based on the rules defined in the guard.

Lock

By adding the LockTrait to any class, it will be fully compliant with the LockInterface, you could write your own implmentation instead of using LockTrait but this should be pointless in most cases. By implementing LockInterface on your classes, they will expose the same three methods as the Guard explained above as well as one extra setGuard function. The setGuard function needs to be called once to supply your LockInterface instance with a Guard to use in the background, if you do not do this, a NoGuardException will be raised.

Complex resources

Instead of using a string for the resource, your resource can also be an instance of a class that implements the ResourceInterface interface.

Assertions

An assertion is a method that is called to add extra checks to the guard. It can be any callable and will be passed these parameters in order: caller (CallerInterface of null), action (string), resource (ResourceInterface, string or null) and property (string or null). Caller will be the CallerInterface associated with the Guard instance, while action, resource and property will be the values that were originally passed to the can method.


All versions of guard with dependencies

PHP Build Version
Package Version
Requires php Version ^5.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 bubobox/guard contains the following files

Loading the files please wait ....