Download the PHP package tracesoftwareinternational/elephant-guard without Composer

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

Elephant Guard

Build Status Latest Version

This middleware is meant to apply a given AuthenticatorInterface on a given set of routes.

It can be used with all frameworks using PSR-7 or PSR-15 style middlewares. It has been tested with Slim Framework.

Credits

Huge thanks to Mika Tuupola for his greatly structured PSR-15 compliant middlewares that inspired us (thinking of slim-jwt-auth and slim-basic-auth), Elephant Guard contains some of his work, a lot of thanks Mika !

Install

Install latest version using composer.

Usage

Configuration options are passed as an array. Only mandatory parameter is authenticator.

For more information, please refer to Parameters.

Parameters

Authenticator

The main purpose of this library is to test an incoming request against a class that implements AuthenticatorInterface

By example, you could use a random based authentication :

Same thing can also be accomplished with anonymous class declaration.

Path

The optional path parameter allows you to specify the protected part of your website. It can be either a string or an array. You do not need to specify each URL. Instead think of path setting as a folder. In the example below everything starting with /api will be authenticated.

Ignore

With optional ignore parameter you can make exceptions to path parameter. In the example below everything starting with /api and /admin will be authenticated with the exception of /api/token and /admin/ping which will not be authenticated.

You may use the Glob syntax as supported by webmozart/glob to ignore routes with parameters in URL (like /products/123456)

Before

Before function is called only when authentication succeeds but before the next incoming middleware is called. You can use this to alter the request before passing it to the next incoming middleware in the stack. If it returns anything else than \Psr\Http\Message\RequestInterface the return value will be ignored.

After

After function is called only when authentication succeeds and after the incoming middleware stack has been called. You can use this to alter the response before passing it next outgoing middleware in the stack. If it returns anything else than \Psr\Http\Message\ResponseInterface the return value will be ignored.

Setting response body when authentication fails

By default Elephant Guard returns an empty response body with 401 response and an array of "arguments".

arguments will be an array containing two indexes :

You can return custom body using by providing an error handler. This is useful for example when you need additional information why authentication failed.

Testing

You can run tests manually with composer :

License

The GNU General Public License v3.0 (GPL v3.0). Please see License File for more information.


All versions of elephant-guard with dependencies

PHP Build Version
Package Version
Requires php Version ^7.1
psr/http-message Version ^1.0
psr/http-server-middleware Version ^1.0
tuupola/callable-handler Version ^1.0
tuupola/http-factory Version ^1.0
webmozart/glob Version ^4.1
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 tracesoftwareinternational/elephant-guard contains the following files

Loading the files please wait ....