Download the PHP package webiik/account without Composer

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

Account

The Account provides common interface for user authentication.

Installation

Example

The following example expects you have already written your account implementation and you use email and password for user authentication.

Settings

addAccount

addAccount() adds an implementation of account.

useAccount

useAccount() sets account to be used when calling custom account related methods.

setNamespace

setNamespace() sets authentication namespace. It allows you to use separate authentication for different parts of your application. If you don't set any namespace, it means user belongs to default namespace.

Writing Your Custom Account

To write your account implementation you have to extend from abstract class namespace to each method. Read below intended function of each mentioned method and adapt your implementation to it.

auth

auth() authenticates a user with credentials. On success returns AccountException. Possible exception status codes: METHOD_IS_NOT_IMPLEMENTED, INVALID_CREDENTIAL, INVALID_PASSWORD, ACCOUNT_DOES_NOT_EXIST, ACCOUNT_IS_NOT_ACTIVATED, ACCOUNT_IS_BANNED, ACCOUNT_IS_DISABLED, FAILURE

To compare passwords, always use secure method verifyPassword(string $password, string $hash): bool provided by AccountBase.

reAuth

reAuth() re-authenticates a user by unique user identifier uid. On success returns AccountException. Possible exception status codes: METHOD_IS_NOT_IMPLEMENTED, ACCOUNT_DOES_NOT_EXIST, ACCOUNT_IS_NOT_ACTIVATED, ACCOUNT_IS_BANNED, ACCOUNT_IS_DISABLED, FAILURE

signup

signup() signs up a user with credentials. On success returns AccountException. Possible exception status codes: METHOD_IS_NOT_IMPLEMENTED, INVALID_CREDENTIAL, ACCOUNT_ALREADY_EXISTS, FAILURE

Never store passwords in plain text. AccountBase provides you secure method to hash passwords hashPassword(string $password): string.

update

update() updates data on account with id uid. On success returns AccountException. Possible exception status codes: METHOD_IS_NOT_IMPLEMENTED, ACCOUNT_DOES_NOT_EXIST, INVALID_KEY, FAILURE

disable

disable() sets account status to ACCOUNT_IS_DISABLED or ACCOUNT_IS_BANNED on account with id uid. On success returns AccountException. Possible exception status codes: METHOD_IS_NOT_IMPLEMENTED, ACCOUNT_DOES_NOT_EXIST, FAILURE

delete

delete() deletes an account with id uid. On success returns AccountException. Possible exception status codes: METHOD_IS_NOT_IMPLEMENTED, ACCOUNT_DOES_NOT_EXIST, FAILURE

createToken

createToken() creates and returns time limited security token. On error throws AccountException. Possible exception status codes: METHOD_IS_NOT_IMPLEMENTED, FAILURE

activate

activate() activates an account by valid token. On success returns AccountException. Possible exception status codes: METHOD_IS_NOT_IMPLEMENTED, INVALID_TOKEN, FAILURE

resetPassword

resetPassword() updates account password by valid token. On success returns AccountException. Possible exception status codes: METHOD_IS_NOT_IMPLEMENTED, INVALID_TOKEN, FAILURE

Never store passwords in plain text. AccountBase provides you secure method to hash passwords hashPassword(string $password): string.

User

User is an object returned by several Account methods. User provides handy methods to work with authenticated user.

__construct

__construct() creates User object.

Parameters

getId

getId() returns unique user account id.

getRole

getRole() returns user role.

hasRole

hasRole() checks if user has given role.

getInfo

getInfo() returns additional user account info.

needsActivation

needsActivation() checks if user account requires activation.

Account Exception

AccountException has to be thrown by all implemented account methods. Unlike standard Exception, AccountException has one extra parameter validationResult. This parameter is intended to store invalid credentials in the following format e.g. ['email' => ['Invalid email'], 'password' => ['Password is too short.']]

__construct

__construct() creates AccountException object.

getValidationResult

getValidationResult() returns invalid credentials.

Resources


All versions of account with dependencies

PHP Build Version
Package Version
Requires php Version >=7.2
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 webiik/account contains the following files

Loading the files please wait ....