Download the PHP package dyorg/slim-token-authentication without Composer

On this page you can find all versions of the php package dyorg/slim-token-authentication. 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 slim-token-authentication

Slim Token Authentication

This is a Token Authentication Middleware for Slim 3.0+. This middleware was designed to maintain easy to implement token authentication with custom authenticator.

Installing

Get the latest version with Composer.

Getting authentication

Start by creating an authenticator function, this function will make the token validation of your application. When you create a new instance of TokenAuthentication you must pass an array with configuration options. You need setting authenticator and path options for authentication to start working.

Find Token

This middleware contains the method findToken(), you can access it from your authenticator method through the second param (TokenAuthentication instance). This method is able to search for authentication token on header, parameter, cookie or attribute. You can configure it through options settings.

Configuration Options

Path

By default no route requires authentication. You must set one or more routes to be restricted by authentication, setting it on path option.

Passthrough

You can configure which routes do not require authentication, setting it on passthrough option.

Header

By default middleware tries to find token from Authorization header. You can change header name using header option. Is expected in Authorization header the value format as Bearer <token>, it is matched using a regular expression. If you want to work without token type or with other token type, like Basic <token>, you can change the regular expression pattern setting it on regex option. You can disabled authentication via header by setting header option as null.

Parameter

If token is not found in header, middleware tries to find authorization query parameter. You can change parameter name using parameter option. You can disable authentication via parameter by setting parameter option as null.

Cookie

If token is not found yet, middleware tries to find authorization cookie. You can change cookie name using cookie option. You can disabled authentication via cookie by setting cookie option as null.

Argument

As a last resort, middleware tries to find authorization argument of route. You can change argument name using argument option. You can disabled authentication via argument by setting argument option as null.

Error

By default on ocurred a fail on authentication, is sent a response on json format with a message (Invalid Token or Not found Token) and with the token (if found), with status 401 Unauthorized. You can customize it by setting a callable function on error option.

This error function is called when TokenAuthentication catches a throwable class that implements UnauthorizedExceptionInterface.

Secure

Tokens are essentially passwords. You should treat them as such and you should always use HTTPS. If the middleware detects insecure usage over HTTP it will return unathorized with a message Required HTTPS for token authentication. This rule is relaxed for requests on localhost. To allow insecure usage you must enable it manually by setting secure to false.

Alternatively you can list your development host to have relaxed security.

Example

See how use it on /example.

License

The MIT License (MIT). Please see License for more information.


All versions of slim-token-authentication with dependencies

PHP Build Version
Package Version
Requires php Version >=5.4.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 dyorg/slim-token-authentication contains the following files

Loading the files please wait ....