Download the PHP package eril/auth without Composer

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

Eril Auth

Lightweight authentication and authorization library for modern PHP applications.

Eril Auth provides session-based authentication, persistent login (Remember Me), role-based authorization (RBAC), login rate limiting, provider login, user profiles and diagnostics without requiring a framework.


Features


Requirements


Installation

Install via Composer:

Generate the default configuration:

Or publish only the configuration files:

Verify your installation:


Quick Start

Load the configuration during application bootstrap.

This automatically creates:

Authenticate a user:


Configuration

The installer generates a complete config/auth.php file with documentation for every available option.

A minimal configuration looks like this:

The generated configuration file contains additional options for:


Authentication

Login

Authenticate using the configured login field(s).

If multiple login fields are configured:

The following will all work:


Manual Login

You may authenticate a user manually.

This is useful when authentication is handled by another system.


Login with Provider

Eril Auth supports authentication through externally validated identity providers.

Typical flow:

Example:

Eril Auth does not implement OAuth.

Token validation must be performed by your application or an OAuth library before calling loginWithProvider().


Remember Me

Enable persistent login:

After a successful login:

On future visits, Eril Auth automatically restores the session if the remember cookie is valid.

Database

Remember Me requires two nullable columns in the users table.


Login Rate Limiting

Protect login attempts against brute-force attacks.

Available key strategies:

Strategy Description
login Limit by login value
ip Limit by client IP
login_ip Limit by login + IP

Logout


Authentication State

Determine whether a user is authenticated.

Or check if no user is authenticated.


Current User

Retrieve the authenticated user.

Retrieve the authenticated user's identifier.

Retrieve the authenticated user's profile.

AuthUser

AuthUser represents the currently authenticated user.

It provides convenient methods for accessing user data, checking roles and permissions, and loading the associated profile.


Standard Methods


Role Checks

Equivalent using the facade:


Permission Checks

Equivalent:


Dynamic Properties

Every column from the original database row remains available.


Array Access

AuthUser implements ArrayAccess.


Utility Methods

Convert the authenticated user to an array.

Select only specific fields.

Exclude fields.

Access the original database row.


Profiles

Many applications store additional information in separate profile tables.

Example:

Configure the relationship:

Retrieve the authenticated profile:

or

Access profile data:

Profiles are loaded lazily and remain independent from AuthUser.

This avoids unnecessary database queries and keeps authentication data separate from domain-specific information.


Authorization (RBAC)

Permissions are configured per role.

Example:

basically:


Checking Permissions

Negated check:

Require a permission:

If authorization fails, an AuthorizationException is thrown.


Wildcards

Grant every permission:

Grant every permission within a namespace:

Which automatically matches:


Diagnostics

Inspect the current authentication configuration.

Typical output:

The diagnostic tool validates:


Exceptions

Eril Auth provides dedicated exceptions.

Example:


API Reference

Configuration


Authentication


Current User


Roles


Permissions


Utilities


Out of Scope

Eril Auth intentionally focuses on session-based authentication and authorization.

The following features are intentionally not included:

These features are better implemented by your application or by dedicated libraries.


License

Licensed under the MIT License.


All versions of auth with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
ext-pdo Version *
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 eril/auth contains the following files

Loading the files please wait ...