What potential pitfalls should be considered when including classes in PHP files for use in templates and modules?

When including classes in PHP files for use in templates and modules, it's important to consider potential namespace conflicts that may arise if multiple classes with the same name are included. To avoid this issue, you can use namespaces to encapsulate your classes and prevent naming collisions.

// Define a namespace for your class
namespace MyNamespace;

// Include the file containing your class
require_once 'MyClass.php';

// Create an instance of your class using the fully qualified class name
$myClass = new MyNamespace\MyClass();