Neuron-PHP

IUserRepository

User repository interface.

Table of Contents

Methods

all()  : array<string|int, mixed>
Get all users
count()  : int
Count total users
create()  : User
Create a new user
delete()  : bool
Delete a user
findByEmail()  : User|null
Find user by email
findById()  : User|null
Find user by ID
findByRememberToken()  : User|null
Find user by remember token
findByUsername()  : User|null
Find user by username
incrementFailedLoginAttempts()  : int
Atomically increment failed login attempts for a user
resetFailedLoginAttempts()  : bool
Atomically reset failed login attempts and unlock account
setLockedUntil()  : bool
Atomically set account lockout until specified time
update()  : bool
Update an existing user

Methods

all()

Get all users

public all() : array<string|int, mixed>
Return values
array<string|int, mixed>

delete()

Delete a user

public delete(int $id) : bool
Parameters
$id : int
Return values
bool

findByEmail()

Find user by email

public findByEmail(string $email) : User|null
Parameters
$email : string
Return values
User|null

findById()

Find user by ID

public findById(int $id) : User|null
Parameters
$id : int
Return values
User|null

findByRememberToken()

Find user by remember token

public findByRememberToken(string $token) : User|null
Parameters
$token : string
Return values
User|null

findByUsername()

Find user by username

public findByUsername(string $username) : User|null
Parameters
$username : string
Return values
User|null

incrementFailedLoginAttempts()

Atomically increment failed login attempts for a user

public incrementFailedLoginAttempts(int $userId) : int
Parameters
$userId : int

User ID

Return values
int

New failed login attempts count, or -1 if user not found

resetFailedLoginAttempts()

Atomically reset failed login attempts and unlock account

public resetFailedLoginAttempts(int $userId) : bool
Parameters
$userId : int

User ID

Return values
bool

True if successful, false if user not found

setLockedUntil()

Atomically set account lockout until specified time

public setLockedUntil(int $userId, DateTimeImmutable|null $lockedUntil) : bool
Parameters
$userId : int

User ID

$lockedUntil : DateTimeImmutable|null

Locked until time, or null to unlock

Return values
bool

True if successful, false if user not found

update()

Update an existing user

public update(User $user) : bool
Parameters
$user : User
Return values
bool

        
On this page

Search results