68publishers / user
Provides user management for your Nette project.
Requires
- php: ^8.3
- 68publishers/doctrine-bridge: ^2.0
- 68publishers/doctrine-persistence: ^0.4
- 68publishers/doctrine-query-objects: ^0.3
- 68publishers/smart-nette-component: ^2.0
- 68publishers/translation-bridge: ^3.0
- doctrine/orm: ^2.10 || ^3.0
- matomo/device-detector: ^4.0 || ^5.0 || ^6.0
- nette/application: ^3.1
- nette/di: ^3.1.3
- nette/forms: ^3.0
- nette/http: ^3.0
- nette/security: ^3.1.8
- nette/utils: ^3.2.10 || ^4.0.1
- ramsey/uuid: ^4.1
- symfony/event-dispatcher: ^5.1 || ^6.0 || ^7.0 || ^8.0
- tracy/tracy: ^2.6
Requires (Dev)
- contributte/mailing: ^0.5 || ^0.6 || ^0.7
- doctrine/annotations: ^1.13 || ^2.0
- friendsofphp/php-cs-fixer: ^3.75
- nette/tester: ^2.6
- psr/log: ^1.0 || ^2.0 || ^3.0
- roave/security-advisories: dev-latest
- symfony/var-exporter: ^6.4 || ^7.0
Suggests
- contributte/mailing: If you want to use default mail sender.
Provides
None
Conflicts
None
Replaces
None
README
⚠️ Warning! This package does not have active support, it exists only for the historical needs of the author.
User
The package adds support for a database-backed user system for Nette. It provides a user management that aims to handle common tasks such as user registration, login, password retrieval and much more.
Installation
The best way to install 68publishers/user is using Composer:
composer require 68publishers/user
Requirements: PHP ^8.3, doctrine/orm ^2.10 || ^3.0, nette/security ^3.1.8.
The entities are mapped with PHP attributes and registered through 68publishers/doctrine-bridge with the attribute driver (EntityMapping::DRIVER_ATTRIBUTE), so a mapping driver service of the type Doctrine\ORM\Mapping\Driver\AttributeDriver must exist in the container. Applications that map their own entities with annotations (doctrine/orm 2) only need to register it next to the annotation driver, e.g.:
services: attributeDriver: factory: Doctrine\ORM\Mapping\Driver\AttributeDriver([], true) autowired: false
or use Nettrine\ORM\DI\OrmAttributesExtension of nettrine/orm (the bridge option 68publishers.doctrine_bridge.services.drivers.attribute selects the driver service if there are more of them). Create the driver with reportFieldsWhereDeclared: true (the second argument, the only mode of doctrine/orm 3, false is deprecated since doctrine/orm 2.16). Annotation-mapped application entities can still relate to the package entities (PasswordRequest relates to your user entity through the resolved UserInterface).
Upgrade
From 0.5 to 0.6
- The minimal PHP version is 8.3.
- The package requires
68publishers/doctrine-bridge^2.0,68publishers/doctrine-persistence^0.4,68publishers/doctrine-query-objects^0.3,68publishers/smart-nette-component^2.0and68publishers/translation-bridge^3.0. - The class
SixtyEightPublishers\User\Common\EventSubscriber\HashUserPasswordSubscriberwas removed. It was never registered by the bundle, passwords are hashed by thePasswordvalue object and thePasswordType. - The entities (
PasswordRequest,DeviceInfo) are mapped with PHP attributes instead of annotations (the database schema is the same) anddoctrine/orm3 is supported. Register a service of the typeDoctrine\ORM\Mapping\Driver\AttributeDriver(see Installation), otherwise the container compilation fails with "Can't resolve service definition ... services.drivers.attribute". doctrine/annotationsis no longer required.- The authenticator service is registered with the type
Nette\Security\Authenticator(previously the deprecatedIAuthenticator), so it is autowired for both interfaces.
Usage
// @todo
Rules for contributing
- 1 PR per feature
- PR with tests are more likely to be merged
- tests and coding standard must pass
vendor/bin/tester ./tests -s vendor/bin/php-cs-fixer fix -v --dry-run