Download the PHP package tobento/app-user without Composer

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

App User

User support for the app with authentication and authorization.

Table of Contents

Getting Started

Add the latest version of the app user project running this command.

Requirements

Documentation

App

Check out the App Skeleton if you are using the skeleton.

You may also check out the App to learn more about the app in general.

User Boot

The user boot does the following:

User Config

The configuration for the user is located in the file at the default App Skeleton config location.

User Repositories And Factories

The following repositories and factories are available as defined in the config file. The default repository implementation uses the as the storage, defined in the file, which is the file storage by default:

You may check out the Repository Interface to learn more about it.

User Authentication And Authenticator

The following authentication and authenticator interfaces are available as defined in the config file by default.

Retrieve Current User

The current user will be available by the after the process of the defined in the config file.

Retrieve Authenticated User

The authenticated user will be available by the after the process of the defined in the config file.

Authenticate User

There are many ways to authenticate a user depending on your config file configuration.

General authentication workflow:

You may use an authenticator to authenticate a user:

See Identity Authenticator - Login Controller Example for instance.

Unauthenticate User

To unauthenticate a user call the method from the :

Acl Boot

The acl boot does the following:

The acl boot gets booted automatically by the User Boot!

You may check out the Acl Service to learn more about it.

Adding Roles

The acl boot will add all roles found from the . You can add roles by the following ways:

Using a migration

Then Install The Migration using the app migration.

Using In Memory Storage

You may use the In Memory Storage instead of the default defined in the config file:

You may verify roles by the Verify Role Middleware.

Adding Rules

By default, no rules are added. You might add rules by the following ways:

Using the app

Using the acl boot

Permissions will be verified by the Verify Permission Middleware.

Check out the Rules to learn more about it.

Authorize User By Permission

There are several ways to authorize a user to access resources by checking its permission.

You may check out the Acl - Permissions section to learn more about it.

Using the acl

Using the user

Using middleware

Use the Verify Permission Middleware to verify permission on routes.

Authorize User By Role

Using the acl

Using the user

Using middleware

Use the Verify Role Middleware to verify role on routes.

Http User Error Handler Boot

The http user error handler boot handles any user specific exceptions such as:

Adding the boot:

You may create a custom Error Handler or add an Error Handler With A Higher Priority of as defined on the .

Middleware

User Middleware

The middleware will ensure that there is always a user available from the request attributes. Furthermore, it sets the current acl user.

Code snippet from the middleware process method:

Authentication Middleware

The middleware will try to authenticate the user on every request by using the defined token transport(s) to fetch the token from the request which will be authenticated by the token authenticator.

Code snippet from the middleware process method:

Authentication With Middleware

Check out the Different Authentication Per Routes section to learn more about this middleware.

Authenticated Middleware

The middleware protects routes from unauthenticated users.

Unauthenticated Middleware

The middleware protects routes from authenticated users.

Verified Middleware

The middleware protects routes from unverified users.

Check out the User Channel Verification section to learn more about it.

Verify Permission Middleware

The middleware protects routes from users without the defined permission(s). If a user has insufficient permission a will be thrown.

Check out the Http User Error Handler Boot how to handle the exception.

Verify Route Permission Middleware

The middleware protects routes from users without the defined permissions. If a user has insufficient permission a will be thrown.

Check out the Http User Error Handler Boot how to handle the exception.

Verify Role Middleware

The middleware protects routes from users without the defined role(s). If a user has insufficient role a will be thrown.

Check out the Http User Error Handler Boot how to handle the exception.

Authenticator

Identity Authenticator

The identifies the user by the and/or and/or from the request input . Furthermore, it verifies the user password from the request input . You can specify which attributes are allowed for identification and if you want to verify the password.

Login Controller Example

Attributes Authenticator

The identifies the user by the specified user attributes. Unlike the Identity Authenticator this authenticator identifies the user by all attributes.

Login Controller Example

User Verifier

User verifiers may be used to verify certain user attributes while authenticating a user. See Identity Authenticator for instance.

User Permission Verifier

User Role Verifier

User Role Area Verifier

Token Authenticator

The token authenticator is responsible to authenticate the user based on the token. See Authentication Middleware for more detail.

You may add token verifiers in the file to verify certain token payload attributes:

Token Verifier

Token verifiers may be used to verify certain token payload attributes while authenticating a user by token. See Token Authenticator for instance.

Token Password Hash Verifier

The may be used to invalidate tokens if user changes password.

Token Payload Verifier

The may be used to invalidate tokens if the specified payload attribute does not match the given value.

Token Storage

Null Storage

The does not store any token at all. This means you will never be authenticated.

In file:

In Memory Storage

The does store tokens in memory only.

In file:

Repository Storage

The uses the Service Repository Storage to store tokens.

In file:

Delete expired tokens

You may call the method to delete all expired tokens:

Session Storage

Stores the token in PHP session.

In file:

Make sure you boot the App Http - Session Boot in your app:

Token Transport

Cookie Transport

Stores the authentication token in a cookie.

In file:

Make sure you boot the App Http - Cookies Boot in your app:

Header Transport

Stores the authentication token in a HTTP header.

In file:

Events

Available Events

Event Description
The event will dispatch after the user authenticated success
The event will dispatch after the user unauthenticated success.
The event will dispatch after the user is created.
The event will dispatch after the user is updated.
The event will dispatch after the user is deleted.

Supporting Events

Simply, install the App Event bundle.

Console

Before using commands, you will need to install the App Console bundle.

Acl Roles Command

List all acl roles:

Acl Rules Command

List all acl rules:

Delete Expired Tokens Command

You may delete expired tokens from token storages supporting it.

You may delete only from specific token storages:

Migration

Role Permissions Action

You may use the to add and remove permissions for roles.

Then Install The Migration using the app migration.

Learn More

Different Authentication Per Routes

First, configure the file and define token storages and transports you wish to use:

Finally, add middleware to your routes:

Another way to is to use a Http - Area Boot for each area "web" and "api" running in its own application.

Password Hashing

Use the defined in the file to hash and verify user passwords.

Basic Usage

The following authenticators use the password hasher to verify the password:

User Channel Verification

Adding verified channels

Removing verified channels

User verified methods

App User Bundles

You may use the following user bundles for your app.

Credits


All versions of app-user with dependencies

PHP Build Version
Package Version
Requires php Version >=8.0
tobento/app Version ^1.0.7
tobento/app-migration Version ^1.0
tobento/app-http Version ^1.0
tobento/app-database Version ^1.0
tobento/app-validation Version ^1.0
tobento/app-country Version ^1.0
tobento/service-config Version ^1.0
tobento/service-user Version ^1.0.1
tobento/service-acl Version ^1.0
tobento/service-clock Version ^1.0
tobento/service-repository Version ^1.0
tobento/service-repository-storage 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 tobento/app-user contains the following files

Loading the files please wait ....