Skip to content

Commit

Permalink
Migrate to Laminas
Browse files Browse the repository at this point in the history
  • Loading branch information
rarog committed Feb 3, 2020
1 parent 4ecfe82 commit c3e0497
Show file tree
Hide file tree
Showing 74 changed files with 342 additions and 343 deletions.
14 changes: 7 additions & 7 deletions Module.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

namespace ZfcUser;

use Zend\ModuleManager\Feature\ConfigProviderInterface;
use Zend\ModuleManager\Feature\ControllerPluginProviderInterface;
use Zend\ModuleManager\Feature\ControllerProviderInterface;
use Zend\ModuleManager\Feature\ServiceProviderInterface;
use Laminas\ModuleManager\Feature\ConfigProviderInterface;
use Laminas\ModuleManager\Feature\ControllerPluginProviderInterface;
use Laminas\ModuleManager\Feature\ControllerProviderInterface;
use Laminas\ModuleManager\Feature\ServiceProviderInterface;

class Module implements
ControllerProviderInterface,
Expand Down Expand Up @@ -52,18 +52,18 @@ public function getServiceConfig()
{
return array(
'aliases' => array(
'zfcuser_zend_db_adapter' => \Zend\Db\Adapter\Adapter::class,
'zfcuser_zend_db_adapter' => \Laminas\Db\Adapter\Adapter::class,
),
'invokables' => array(
'zfcuser_register_form_hydrator' => \Zend\Hydrator\ClassMethods::class,
'zfcuser_register_form_hydrator' => \Laminas\Hydrator\ClassMethods::class,
),
'factories' => array(
'zfcuser_redirect_callback' => \ZfcUser\Factory\Controller\RedirectCallbackFactory::class,
'zfcuser_module_options' => \ZfcUser\Factory\Options\ModuleOptions::class,
'ZfcUser\Authentication\Adapter\AdapterChain' => \ZfcUser\Authentication\Adapter\AdapterChainServiceFactory::class,

// We alias this one because it's ZfcUser's instance of
// Zend\Authentication\AuthenticationService. We don't want to
// Laminas\Authentication\AuthenticationService. We don't want to
// hog the FQCN service alias for a Zend\* class.
'zfcuser_auth_service' => \ZfcUser\Factory\AuthenticationService::class,

Expand Down
27 changes: 13 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ Created by Evan Coury and the ZF-Commons team
Introduction
------------

ZfcUser is a user registration and authentication module for Zend Framework 2.
Out of the box, ZfcUser works with Zend\Db, however alternative storage adapter
ZfcUser is a user registration and authentication module for Laminas.
Out of the box, ZfcUser works with Laminas\Db, however alternative storage adapter
modules are available (see below). ZfcUser provides the foundations for adding
user authentication and registration to your ZF2 site. It is designed to be very
user authentication and registration to your Laminas site. It is designed to be very
simple and easy to extend.

More information and examples are available on the [ZfcUser Wiki](https://github.com/ZF-Commons/ZfcUser/wiki)
Expand All @@ -26,12 +26,12 @@ Please use below table to figure out what version of ZfcUser you should use.
|-----------------|----------------------------------|---------------------------------------------|
| 1.x | <= 2.5 | Security-fixes only |
| 2.x | >= 2.6 < 3 | bug-fixes, security-fixes |
| 3.x | >= 3 | New features, bug-fixes, security-fixes |
| 3.x | >= 3 / Laminas | New features, bug-fixes, security-fixes |

Storage Adapter Modules
-----------------------

By default, ZfcUser ships with support for using Zend\Db for persisting users.
By default, ZfcUser ships with support for using Laminas\Db for persisting users.
However, by installing an optional alternative storage adapter module, you can
take advantage of other methods of persisting users:

Expand All @@ -41,8 +41,7 @@ take advantage of other methods of persisting users:
Requirements
------------

* [Zend Framework 2](https://github.com/zendframework/zf2) (latest master)
* [ZfcBase](https://github.com/ZF-Commons/ZfcBase) (latest master).
* [Laminas](https://github.com/ZF-Commons/ZfcUser.git).

Features / Goals
----------------
Expand All @@ -51,7 +50,7 @@ Features / Goals
username and use strictly email) [COMPLETE]
* User registration [COMPLETE]
* Forms protected against CSRF [COMPLETE]
* Out-of-the-box support for Doctrine2 _and_ Zend\Db [COMPLETE]
* Out-of-the-box support for Doctrine2 _and_ Laminas\Db [COMPLETE]
* Robust event system to allow for extending [COMPLETE]
* Provide ActionController plugin and view helper [COMPLETE]

Expand Down Expand Up @@ -107,9 +106,9 @@ Coming soon...

Coming soon...

### Post-Install: Zend\Db
### Post-Install: Laminas\Db

1. If you do not already have a valid Zend\Db\Adapter\Adapter in your service
1. If you do not already have a valid Laminas\Db\Adapter\Adapter in your service
manager configuration, put the following in `./config/autoload/database.local.php`:

```php
Expand All @@ -124,7 +123,7 @@ return array(
),
'service_manager' => array(
'factories' => array(
'Zend\Db\Adapter\Adapter' => 'Zend\Db\Adapter\AdapterServiceFactory',
'Laminas\Db\Adapter\Adapter' => 'Laminas\Db\Adapter\AdapterServiceFactory',
),
),
);
Expand Down Expand Up @@ -183,8 +182,8 @@ The following options are available:
after they successfully register. Default value is `false`.
- **use_registration_form_captcha** - Boolean value, determines if a captcha should
be utilized on the user registration form. Default value is `true`. (Note,
right now this only utilizes a weak Zend\Text\Figlet CAPTCHA, but I have plans
to make all Zend\Captcha adapters work.)
right now this only utilizes a weak Laminas\Text\Figlet CAPTCHA, but I have plans
to make all Laminas\Captcha adapters work.)
- **login_form_timeout** - Integer value, specify the timeout for the CSRF security
field of the login form in seconds. Default value is 300 seconds.
- **user_form_timeout** - Integer value, specify the timeout for the CSRF security
Expand Down Expand Up @@ -226,7 +225,7 @@ module.config.php, or a dedicated recaptcha.config.php):
'instance'=>array(
'alias'=>array(
// OTHER ELEMENTS....
'recaptcha_element' => 'Zend\Form\Element\Captcha',
'recaptcha_element' => 'Laminas\Form\Element\Captcha',
),
'recaptcha_element' => array(
'parameters' => array(
Expand Down
50 changes: 25 additions & 25 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "zf-commons/zfc-user",
"description": "A generic user registration and authentication module for ZF2. Supports Zend\\Db and Doctrine2.",
"description": "A generic user registration and authentication module for ZF3/Laminas. Supports Laminas\\Db and Doctrine2.",
"type": "library",
"license": "BSD-3-Clause",
"keywords": [
Expand All @@ -26,33 +26,33 @@
},
"require": {
"php": "^5.5|^7.0",
"zendframework/zend-authentication": "^2.5",
"zendframework/zend-crypt": "^3.0",
"zendframework/zend-form": "^2.9",
"zendframework/zend-inputfilter": "^2.7",
"zendframework/zend-loader": "^2.5",
"zendframework/zend-modulemanager": "^2.7",
"zendframework/zend-mvc": "^3.0",
"zendframework/zend-servicemanager": "^3.0",
"zendframework/zend-stdlib": "^3.0",
"zendframework/zend-validator": "^2.8",
"zendframework/zend-db": "^2.8",
"zendframework/zend-view": "^2.8",
"zendframework/zend-session" : "^2.7",
"zendframework/zend-http" : "^2.5",
"zendframework/zend-mvc-plugin-flashmessenger": "^1.0",
"zendframework/zend-i18n": "^2.7",
"zendframework/zend-mvc-plugin-prg": "^1.0",
"zendframework/zend-hydrator": "^2.0"
"laminas/laminas-authentication": "^2.5",
"laminas/laminas-crypt": "^3.0",
"laminas/laminas-form": "^2.9",
"laminas/laminas-inputfilter": "^2.7",
"laminas/laminas-loader": "^2.5",
"laminas/laminas-modulemanager": "^2.7",
"laminas/laminas-mvc": "^3.0",
"laminas/laminas-servicemanager": "^3.0",
"laminas/laminas-stdlib": "^3.0",
"laminas/laminas-validator": "^2.8",
"laminas/laminas-db": "^2.8",
"laminas/laminas-view": "^2.8",
"laminas/laminas-session": "^2.7",
"laminas/laminas-http": "^2.5",
"laminas/laminas-mvc-plugin-flashmessenger": "^1.0",
"laminas/laminas-i18n": "^2.7",
"laminas/laminas-mvc-plugin-prg": "^1.0",
"laminas/laminas-hydrator": "^2.0"
},
"require-dev" : {
"phpunit/phpunit" : ">=3.7,<4",
"phpmd/phpmd" : "1.4.*",
"squizlabs/php_codesniffer" : "1.4.*",
"zendframework/zend-captcha" : "^2.6"
"require-dev": {
"phpunit/phpunit": ">=3.7,<4",
"phpmd/phpmd": "1.4.*",
"squizlabs/php_codesniffer": "1.4.*",
"laminas/laminas-captcha": "^2.6"
},
"suggest": {
"zendframework/zend-captcha" : "Zend\\Captcha if you want to use the captcha component"
"laminas/laminas-captcha": "Laminas\\Captcha if you want to use the captcha component"
},
"autoload": {
"psr-0": {
Expand Down
10 changes: 5 additions & 5 deletions config/zfcuser.global.php.dist
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
*/
$settings = array(
/**
* Zend\Db\Adapter\Adapter DI Alias
* Laminas\Db\Adapter\Adapter DI Alias
*
* Please specify the DI alias for the configured Zend\Db\Adapter\Adapter
* Please specify the DI alias for the configured Laminas\Db\Adapter\Adapter
* instance that ZfcUser should use.
*/
//'zend_db_adapter' => 'Zend\Db\Adapter\Adapter',
//'zend_db_adapter' => 'Laminas\Db\Adapter\Adapter',

/**
* User Model Entity Class
Expand Down Expand Up @@ -115,7 +115,7 @@ $settings = array(
* Form Captcha Options
*
* Currently used for the registration form, but re-usable anywhere. Use
* this to configure which Zend\Captcha adapter to use, and the options to
* this to configure which Laminas\Captcha adapter to use, and the options to
* pass to it. The default uses the Figlet captcha.
*/
/*'form_captcha_options' => array(
Expand Down Expand Up @@ -229,7 +229,7 @@ return array(
'zfcuser' => $settings,
'service_manager' => array(
'aliases' => array(
'zfcuser_zend_db_adapter' => (isset($settings['zend_db_adapter'])) ? $settings['zend_db_adapter']: 'Zend\Db\Adapter\Adapter',
'zfcuser_zend_db_adapter' => (isset($settings['zend_db_adapter'])) ? $settings['zend_db_adapter']: 'Laminas\Db\Adapter\Adapter',
),
),
);
2 changes: 1 addition & 1 deletion src/ZfcUser/Authentication/Adapter/AbstractAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace ZfcUser\Authentication\Adapter;

use Zend\Authentication\Storage;
use Laminas\Authentication\Storage;

abstract class AbstractAdapter implements ChainableAdapter
{
Expand Down
14 changes: 7 additions & 7 deletions src/ZfcUser/Authentication/Adapter/AdapterChain.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

namespace ZfcUser\Authentication\Adapter;

use Zend\Authentication\Adapter\AdapterInterface;
use Zend\Authentication\Result as AuthenticationResult;
use Zend\EventManager\Event;
use Zend\EventManager\EventInterface;
use Zend\EventManager\EventManagerAwareTrait;
use Zend\Stdlib\RequestInterface as Request;
use Zend\Stdlib\ResponseInterface as Response;
use Laminas\Authentication\Adapter\AdapterInterface;
use Laminas\Authentication\Result as AuthenticationResult;
use Laminas\EventManager\Event;
use Laminas\EventManager\EventInterface;
use Laminas\EventManager\EventManagerAwareTrait;
use Laminas\Stdlib\RequestInterface as Request;
use Laminas\Stdlib\ResponseInterface as Response;
use ZfcUser\Exception;

class AdapterChain implements AdapterInterface
Expand Down
4 changes: 2 additions & 2 deletions src/ZfcUser/Authentication/Adapter/AdapterChainEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

namespace ZfcUser\Authentication\Adapter;

use Zend\EventManager\Event;
use Zend\Stdlib\RequestInterface as Request;
use Laminas\EventManager\Event;
use Laminas\Stdlib\RequestInterface as Request;

class AdapterChainEvent extends Event
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@

use Interop\Container\ContainerInterface;
use Interop\Container\Exception\ContainerException;
use Zend\ServiceManager\Exception\ServiceNotCreatedException;
use Zend\ServiceManager\Exception\ServiceNotFoundException;
use Zend\ServiceManager\Factory\FactoryInterface;
use Zend\ServiceManager\ServiceLocatorInterface;
use Laminas\ServiceManager\Exception\ServiceNotCreatedException;
use Laminas\ServiceManager\Exception\ServiceNotFoundException;
use Laminas\ServiceManager\Factory\FactoryInterface;
use Laminas\ServiceManager\ServiceLocatorInterface;
use ZfcUser\Authentication\Adapter\AdapterChain;
use ZfcUser\Options\ModuleOptions;
use ZfcUser\Authentication\Adapter\Exception\OptionsNotFoundException;
Expand Down
4 changes: 2 additions & 2 deletions src/ZfcUser/Authentication/Adapter/ChainableAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

namespace ZfcUser\Authentication\Adapter;

use Zend\Authentication\Storage\StorageInterface;
use Zend\EventManager\EventInterface;
use Laminas\Authentication\Storage\StorageInterface;
use Laminas\EventManager\EventInterface;

interface ChainableAdapter
{
Expand Down
10 changes: 5 additions & 5 deletions src/ZfcUser/Authentication/Adapter/Db.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
namespace ZfcUser\Authentication\Adapter;

use Interop\Container\ContainerInterface;
use Zend\Authentication\Result as AuthenticationResult;
use Zend\EventManager\EventInterface;
use Zend\ServiceManager\ServiceManager;
use Zend\Crypt\Password\Bcrypt;
use Zend\Session\Container as SessionContainer;
use Laminas\Authentication\Result as AuthenticationResult;
use Laminas\EventManager\EventInterface;
use Laminas\ServiceManager\ServiceManager;
use Laminas\Crypt\Password\Bcrypt;
use Laminas\Session\Container as SessionContainer;
use ZfcUser\Entity\UserInterface;
use ZfcUser\Mapper\UserInterface as UserMapperInterface;
use ZfcUser\Options\ModuleOptions;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace ZfcUser\Authentication\Adapter\Exception;

use Zend\Math\Exception\RuntimeException;
use Laminas\Math\Exception\RuntimeException;

class OptionsNotFoundException extends RuntimeException
{
Expand Down
14 changes: 7 additions & 7 deletions src/ZfcUser/Authentication/Storage/Db.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
namespace ZfcUser\Authentication\Storage;

use Interop\Container\ContainerInterface;
use Zend\Authentication\Storage;
use Zend\Authentication\Storage\StorageInterface;
use Zend\ServiceManager\ServiceManager;
use Laminas\Authentication\Storage;
use Laminas\Authentication\Storage\StorageInterface;
use Laminas\ServiceManager\ServiceManager;
use ZfcUser\Mapper\UserInterface as UserMapper;

class Db implements Storage\StorageInterface
Expand Down Expand Up @@ -33,7 +33,7 @@ class Db implements Storage\StorageInterface
/**
* Returns true if and only if storage is empty
*
* @throws \Zend\Authentication\Exception\InvalidArgumentException If it is impossible to determine whether
* @throws \Laminas\Authentication\Exception\InvalidArgumentException If it is impossible to determine whether
* storage is empty or not
* @return boolean
*/
Expand All @@ -56,7 +56,7 @@ public function isEmpty()
*
* Behavior is undefined when storage is empty.
*
* @throws \Zend\Authentication\Exception\InvalidArgumentException If reading contents from storage is impossible
* @throws \Laminas\Authentication\Exception\InvalidArgumentException If reading contents from storage is impossible
* @return mixed
*/
public function read()
Expand Down Expand Up @@ -84,7 +84,7 @@ public function read()
* Writes $contents to storage
*
* @param mixed $contents
* @throws \Zend\Authentication\Exception\InvalidArgumentException If writing $contents to storage is impossible
* @throws \Laminas\Authentication\Exception\InvalidArgumentException If writing $contents to storage is impossible
* @return void
*/
public function write($contents)
Expand All @@ -96,7 +96,7 @@ public function write($contents)
/**
* Clears contents from storage
*
* @throws \Zend\Authentication\Exception\InvalidArgumentException If clearing contents from storage is impossible
* @throws \Laminas\Authentication\Exception\InvalidArgumentException If clearing contents from storage is impossible
* @return void
*/
public function clear()
Expand Down
6 changes: 3 additions & 3 deletions src/ZfcUser/Controller/Plugin/ZfcUserAuthentication.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

namespace ZfcUser\Controller\Plugin;

use Zend\Mvc\Controller\Plugin\AbstractPlugin;
use Zend\Authentication\AuthenticationService;
use Zend\ServiceManager\ServiceLocatorInterface;
use Laminas\Mvc\Controller\Plugin\AbstractPlugin;
use Laminas\Authentication\AuthenticationService;
use Laminas\ServiceManager\ServiceLocatorInterface;
use ZfcUser\Authentication\Adapter\AdapterChain as AuthAdapter;

class ZfcUserAuthentication extends AbstractPlugin
Expand Down
8 changes: 4 additions & 4 deletions src/ZfcUser/Controller/RedirectCallback.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

namespace ZfcUser\Controller;

use Zend\Mvc\Application;
use Zend\Router\RouteInterface;
use Zend\Router\Exception;
use Zend\Http\PhpEnvironment\Response;
use Laminas\Mvc\Application;
use Laminas\Router\RouteInterface;
use Laminas\Router\Exception;
use Laminas\Http\PhpEnvironment\Response;
use ZfcUser\Options\ModuleOptions;

/**
Expand Down
Loading

0 comments on commit c3e0497

Please sign in to comment.