What are best practices for structuring classes and their relationships in PHP projects?

When structuring classes and their relationships in PHP projects, it's important to follow best practices such as using proper naming conventions, organizing classes into logical namespaces, and defining clear relationships between classes using inheritance, interfaces, and composition.

<?php

// Example of organizing classes into logical namespaces

namespace App\Models;

class User {
    // Class implementation
}

namespace App\Repositories;

class UserRepository {
    // Class implementation
}

namespace App\Services;

class UserService {
    // Class implementation
}