Download the PHP package skibish/simple-rest-acl without Composer

On this page you can find all versions of the php package skibish/simple-rest-acl. 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-rest-acl

Simple REST ACL

Simplest ACL build, ever.

Build Status Latest Stable Version Total Downloads Coverage Status License

How to install

Run composer require skibish/simple-rest-acl

Idea and motivation

Configure ACL by routes and methods as simply as possible.

How to use it

First, you will need to create acl.yml file. Which can look like this:

In your code you start ACL as follows:

And you are ready to go!

acl.yml file configuration

File has following possibilities:

Better way to understand thing is using examples.

Examples

Example #1

Assume, we have following configuration:

And we have request GET /photos/12 and available role is role1. It will match, because default type is resource. If type is resource it will match following routes:

And in GET we specified array of two roles role1 and role2. Available role is role1 and it is in array. So, method verify() in this case will return true.

Example #2

Assume, we have following configuration:

Behind the scenes ACL uses nikic/FastRoute to match the routes. Thus you can use regex in route definition. But in this case don't forget to set type to strict.

In this case only routes that have digit after /strict part will match. If we pass GET /strict/foo, method verify() will return false. If GET /strict/42 - it will be true.

Options

Third parameter in ACL constructor is array of options. Currently there are two options:

Code snippet:

Logging

If you need to log something from this library, you can use PSR-3 compatible loggers.

Missing roles

If you need to know, what roles are missing, use $acl->getMissingRoles(). It will return array of missing roles.

Contribution

If you see, that something can be improved, feel free to submit a pull request.


All versions of simple-rest-acl with dependencies

PHP Build Version
Package Version
Requires php Version >=5.5.9
symfony/yaml Version ^3.1
nikic/fast-route Version ^1.0
psr/log Version ^1.0
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 skibish/simple-rest-acl contains the following files

Loading the files please wait ....