Download the PHP package erdiko/authenticate without Composer

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

Authenticate

Package version CircleCI license

User Authentication

Compatibility

This is compatible with PHP 5.4 or above and the latest version of Erdiko.

Installation

Add package using composer

composer require erdiko/authenticate

Requirements

Between its requirements we count on Pimple, Symfony Security and Firebase PHP-JWT. In case of Pimple, we choose this package to manage Dependency Injection, allowing us to add more flexibility and extensibility. It also adds compatibility with Symfony Security module. Finally the JWT package, is being used to provide a build in working example of authentication extension using this protocol.

How to Use

Before you start using this package, it needs some initial setup/config.

Add authenticate.json config.

In this file will be defined two major components, the first one related with storage and the other related with authentication.

For the storage we provided a SessionStorage service, but you can add your custom storage service just implementing erdiko\authenticate\StorageInterface interface and adding it to the config file.

In case of authentication, there are two steps, Authenticator and Authentication that implements erdiko\authenticate\AuthenticatorInterface and erdiko\authenticate\AuthenticationInterface respectively. Within your app, let's say LoginController or whenever you place the login, you will use an instance of Authenticator that will provide you a set of useful method to login, logout, maintain cache among others. This authenticator object will use the authentication type you select, between all of the enabled options you defined in the authenticate.json config, and that is the implementation of the second Interface.

Here's an example of config file (you can copy from <project>/vendor/erdiko/authenticate/app/config/default/authenticate.json)

As we mention above, the authentication will define the available classes that implements the user's validation logic. You can choose between a list of them defined in this config. For example, you can have one class that allows you to authenticate using oAuth methods, other that use LDAP, other that use database, and so on.

Same for the storage section, except that you should use only one type at time, that's why this section has a selected field.

Let's breakdown the config fields. In both cases:

Extending

Storage

We provide a Session Storage type as default method to manage your user's status and other data. However you can choose a different storage like database, filesystem or memcached just mention few.

In order to create your own storage service, you will have to create a class that implements erdiko\authenticate\StorageInterface like:

and edit your authenticate.json config by adding new item in the storage section and put it as selected

Authentication types

As we mention before, here we need to split in two, authentication and authenticator. Let's start with __authentication_, here we will create class that implements AuthenticationInterface__ where we will put the custom user's validation logic, no matter if it's just a return true, and LDAP call or any other crazy algorithm.

Same as we did with storage, we need to add this new class in the authenticate.json within the available_types section.

The last step is create an authenticator class that implements AuthenticatorInterface. This class is the one you will use in your app to preform the actual login process.

Within this class you will use previous defined tools to authenticate and store data, based on configuration file. Here's an example of login method:

Of course is your choice what method implement, for example, you can opt to skip persistUser if you want to use client side cookie instead of session or any other method on the server side. Said that, we encourage you to implement
persistUser method like this:

It will give you the chance to interconnect your authenticated user with other packages like erdiko/authorize or any Symfony/Security.

Special Thanks

Arroyo Labs - For sponsoring development, http://arroyolabs.com


All versions of authenticate with dependencies

PHP Build Version
Package Version
Requires php Version >=5.4.0
pimple/pimple Version ~3.0
firebase/php-jwt Version ^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 erdiko/authenticate contains the following files

Loading the files please wait ....