Are there any best practices for structuring PHP code to handle multiple user profiles in a web application?

When handling multiple user profiles in a web application, it is important to structure your PHP code in a way that allows for easy management and scalability. One best practice is to use object-oriented programming principles to create user classes that encapsulate user data and behavior. This approach helps keep the code organized and makes it easier to add new functionalities or modify existing ones.

class User {
    private $username;
    private $email;
    
    public function __construct($username, $email) {
        $this->username = $username;
        $this->email = $email;
    }
    
    public function getUsername() {
        return $this->username;
    }
    
    public function getEmail() {
        return $this->email;
    }
    
    // Add more methods as needed for user profile management
}

$user1 = new User('john_doe', 'john.doe@example.com');
echo $user1->getUsername(); // Output: john_doe
echo $user1->getEmail(); // Output: john.doe@example.com