I was trying to figure out how I could manage the premium logic for my freemium Better Together for OpenCart module. You can’t just require
a block of code in the middle of a PHP Class:
class SomeClass {
// NOT ALLOWED!
premium_file = "premium.php";
if (file_exists($premium_file)) {
require($premium_file);
}
So I cooked up another method that I documented in this StackOverflow post about how to include code into a PHP class.