2017 © Pedro Peláez
 

library autogen-username

Username auto-generation plugin for ZfcUser

image

cdli/autogen-username

Username auto-generation plugin for ZfcUser

  • Friday, October 26, 2012
  • by adamlundrigan
  • Repository
  • 3 Watchers
  • 4 Stars
  • 1 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

CdliAutogenUsername

Version 0.2.1 Created by the Centre for Distance Learning and Innovation (www.cdli.ca), (*1)

Build Status, (*2)

Introduction

CdliAutogenUsername is an extension to ZfcUser which provides a flexible username generator.
At it's heart is a simple, event-driven filter chain to which filter plugins are registered to perform specific actions on the username under construction. The module also contains an adapter system for interfacing with external user account systems, such as ZfcUser. It uses these adapters to ensure that every username generated is unique to the system., (*3)

Installation: ZfcUser

Main Setup

  1. Install the ZfcUser ZF2 module by cloning it into ./vendor/ and enabling it in your application.config.php file.
  2. Clone this project into your ./vendor/ directory and enable it in your application.config.php file.
  3. Copy ./vendor/CdliAutogenUsername/config/module.cdliautogenusername.local.php.dist to ./config/autoload/module.cdliautogenusername.local.php.
  4. Fill in the required configuration variable values in the file you just copied.

Activation

To have CdliAutogenUsername automatically inject a generated username when a new user account is created, paste the following snippet into the onBootstrap event of one of your Application's modules:, (*4)

$serviceManager = $e->getTarget()->getServiceManager();
$zfcServiceEvents = $serviceManager->get('zfcuser_user_service')->events();
$zfcServiceEvents->attach('createFromForm', function($e) use ($serviceManager) {
    $user = $e->getParam('user');
    $generator = $serviceManager->get('CdliAutogenUsername\Generator');
    $username = $generator->generate();
    $user->setUsername($username);
));

DISCLAIMER

This code is considered proof-of-concept, and has not been vetted or tested for inclusion in a production environment. Use of this code in such environments is at your own risk., (*5)

Released under the New BSD license. See file LICENSE included with the source code for this project for a copy of the licensing terms., (*6)

The Versions

26/10 2012

dev-master

9999999-dev https://github.com/cdli/CdliAutogenUsername

Username auto-generation plugin for ZfcUser

  Sources   Download

BSD-3-Clause

The Requires

 

zf2 zfcuser random username autogen