What are the best practices for initializing class attributes with require_once functions in PHP?

When initializing class attributes with `require_once` functions in PHP, it is important to ensure that the required file is included only once to prevent redeclaration issues. One way to achieve this is by using the `require_once` function within the constructor of the class to include the required file when the class is instantiated.

class MyClass {
    private $requiredFile;

    public function __construct() {
        require_once 'path/to/required_file.php';
        $this->requiredFile = new RequiredClass();
    }
}