Download the PHP package pitcher/yii2-usr without Composer

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

Usr module

Usr provides basic user actions like:

Advanced features:

See the demo.

Installation

  1. Install Yii2 using your preferred method
  2. Install package via composer
    • Run php composer.phar require nineinchnick/yii2-usr "dev-master" OR add to composer.json require section "nineinchnick/yii2-usr": "dev-master"
    • If one time passwords will be used, also install "sonata-project/google-authenticator"
    • If OAuth will be used, also install "yiisoft/yii2-authclient"
  3. Update config file config/web.php as shown below. Note the from key in messageConfig property of the mail component. Check out the Module for more available options.
  4. Use provided example User model or implement required interfaces in existing User model. These are described in next chapter.

Example config (see Module.php file for full options reference):

$config = [
    // .........
    'aliases' => [
        '@nineinchnick/usr' => '@vendor/nineinchnick/yii2-usr',
    ],
    'modules' => [
        'usr' => [
            'class' => 'nineinchnick\usr\Module',
        ],
    ],
    'components' => [
        'user' => [
            'identityClass' => 'app\models\User',
            'loginUrl' => ['usr/login'],
        ],
        'mail' => [
            'class' => 'yii\swiftmailer\Mailer',
            'useFileTransport' => YII_DEBUG,
            'messageConfig' => [
                'from' => '[email protected]',
            ],
        ],
        // ..........
    ],
]

Requirements for the identity (User) class are described in next chapter.

User interfaces

To be able to use all features of the Usr module, the identity (User) class must implement some or all of the following interfaces.

Editable

This interface allows to create new identities (register) and update existing ones.

Active/disabled and email verification

This interface allows:

Remember to invalidate the email if it changes in the save() method from the Editable interface.

Password history

This interface allows password reset with optional tracking of used passwords. This allows to detect expired passwords and avoid reusing old passwords by users.

See the ExpiredPasswordBehavior description below.

OAuth

This interface allows finding local identity associated with a remote one (from an external social site) and creating such associations.

One Time Password

This interface allow saving and retrieving a secret used to generate one time passwords. Also, last used password and counter used to generate last password are saved and retrieve to protect against reply attacks.

See the OneTimePasswordFormBehavior description below.

Profile Pictures

Allows users to upload a profile picture. The example identity uses Gravatar to provide a default picture.

Managable

Allows to manage users:

Custom login behaviors

The login action can be extended by attaching custom behaviors to the LoginForm. This is done by configuring the UsrModule.loginFormBehaviors property.

There are two such behaviors provided by yii-usr module:

ExpiredPasswordBehavior

Validates if current password has expired and forces the users to change it before logging in.

Options:

OneTimePasswordFormBehavior

Two step authentication using one time passwords.

Options:

Example usage

'loginFormBehaviors' => array(
    'expiredPasswordBehavior' => array(
        'class' => 'ExpiredPasswordBehavior',
        'passwordTimeout' => 10,
    ),
    'oneTimePasswordBehavior' => array(
        'class' => 'OneTimePasswordFormBehavior',
        'mode' => OneTimePasswordFormBehavior::OTP_TIME,
        'required' => true,
        'timeout' => 123,
    ),
    // ... other behaviors
),

User model example

A sample ExampleUser and ExampleUserUsedPassword models along with database migrations are provided respectively in the 'models' and 'migrations' folders.

They could be used as-is by extending from or copying to be modified to better suit a project.

To use the provided migrations it's best to copy them to your migrations directory and adjust the filenames and classnames to current date and time. Also, they could be modified to remove not needed features.

Diceware aka password generator

A simple implementation of a Diceware Passphrase generator is provided to aid users when they need to create a good, long but also easy to remember passphrase.

Install the nineinchnick/diceware composer package to use it.

Read more at the Diceware Passphrase homepage.

Usage scenarios

Varios scenarios can be created by enabling or disabling following features:

Implementing those scenarios require some logic outside the scope of this module.

Public site

Users can register by themselves. Their accounts are activated instantly or after verifying email.

Moderated site

Users can register, but to allow them to log in an administrator must activate their accounts manually, optionally assigning an authorization profile. Email verification is optional and activation could trigger an email notification.

License

MIT or BSD


All versions of yii2-usr with dependencies

PHP Build Version
Package Version
Requires yiisoft/yii2 Version *
yiisoft/yii2-bootstrap 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 pitcher/yii2-usr contains the following files

Loading the files please wait ....