What best practices should PHP developers follow when designing user authentication systems?

When designing user authentication systems in PHP, developers should follow best practices to ensure the security of user data. This includes using secure password hashing algorithms like bcrypt, implementing measures to prevent SQL injection attacks, and enforcing strong password policies.

// Example code snippet for secure password hashing using bcrypt
$password = "user_password";
$hashed_password = password_hash($password, PASSWORD_BCRYPT);

// Example code snippet for verifying hashed password
if (password_verify($password, $hashed_password)) {
    // Password is correct
} else {
    // Password is incorrect
}