Are there any specific best practices for defining class properties in PHP, especially in terms of visibility (public, protected, private)?

When defining class properties in PHP, it is important to consider the visibility of the properties. It is generally recommended to use the "private" visibility for properties that should only be accessed within the class itself, "protected" for properties that should be accessible within the class and its subclasses, and "public" for properties that can be accessed from outside the class. By using the appropriate visibility, you can ensure better encapsulation and maintainability of your code.

class MyClass {
    private $privateProperty;
    protected $protectedProperty;
    public $publicProperty;
    
    public function __construct($private, $protected, $public) {
        $this->privateProperty = $private;
        $this->protectedProperty = $protected;
        $this->publicProperty = $public;
    }
}