Get support for KnpLabs/rad-user
If you're new to LTH, please see our FAQ for more information on what it is we do.
Support Options
Unfortunately, there are currently no active helpers for this repository on the platform. Until they become available, we reccomend the following actions:
View Open IssuesTake a look to see if anyone else has experienced the same issue as you and if they managed to solve it.
Open an IssueMake sure to read any relevant guidelines for opening issues on this repo before posting a new issue.
Sponsor directlyCheck out the page and see if there are any options to sponsor this project or it's developers directly.
KnpLabs/rad-user
DEPRECATED
Unfortunately we decided to not maintain this project anymore (see why). If you want to mark another package as a replacement for this one please send an email to hello@knplabs.com.
Rapid Application Development : User
A Symfony bundle to simply handle password encryption and salt generation
Official maintainers:
Installation
composer require knplabs/rad-user:~2.0
class AppKernel
{
function registerBundles()
{
$bundles = array(
//...
new Knp\Rad\User\Bundle\UserBundle(),
//...
);
//...
return $bundles;
}
}
Usages
I want to auto-generate my user salt
The salt feature is deprecated since PHP 5.5 and BCrypt usage. Please upgrade your version of PHP and use BCrypt.
Your User model should implement the Knp\Rad\User\HasSalt
interface.
namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;
use Knp\Rad\User\HasSalt;
/**
* @ORM\Entity
*/
class User implements HasSalt
{
use HasSalt\HasSalt; //You can also use this trait
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column
*/
private $salt;
}
Now, before your user is inserted into your database, the salt will be auto-generated.
I want to auto-generate my user password
Your User model should implement the Knp\Rad\User\HasInitialPassword
interface.
namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;
use Knp\Rad\User\HasInitialPassword;
/**
* @ORM\Entity
*/
class User implements HasInitialPassword
{
use HasInitialPassword\HasInitialPassword; // You can also use this trait
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column
*/
private $password;
}
Now, before your user is inserted or updated into your database, then the plain password will be automaticly generated.
I want to auto-encode my user password
Your User model should implement the Knp\Rad\User\HasPassword
interface.
namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;
use Knp\Rad\User\HasPassword;
/**
* @ORM\Entity
*/
class User implements HasPassword
{
use HasPassword\HasPassword; // You can also use this trait
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column
*/
private $password;
}
Now, before your user is inserted or updated into your database, if you have set the attribute 'plainPassword', then the password will be automaticly generated.
WARNING
The Knp\Rad\User\HasPassword\HasPassword
trait use the Knp\Rad\User\HasInitialPassword\HasInitialPassword
trait. So don't use both into the same class or you will have a method conflict.
Some tips
Using with MongoDB or CouchDB Object Document Mapper
The knp/rad-user library is also compatible with MongoDB and CouchDB
Our Mission
We want to make open source more sustainable. The entire platform was born from this and everything we do is in aid of this.
From the Blog
Interesting Articles
-
Generating income from open source
Jun 23 • 8 min read
-
2023 State of OSS
Apr 23 • 45 min read ★
-
A funding experiment...
Aug 19 • 10 min read
-
But You Said I could
Aug 19 • 2 min read
Thank you for checking out LiveTechHelper |
2025 © lth-dev incorporated
p-e622a1a2