Modular php system

I am trying to create a modular php system.

Each module is a class that implements the module interface and gets the same name as the php file. Each module is located inside the Modules directory.

I can list each module in a directory, but how to get an instance from them? Is it possible?

A small pseudo code to make it easier to understand:

foreach(scandir($module_dir) as $file){ include $file $module = new $file // How can i make this work?? } 
+4
source share
1 answer
+6
source

Source: https://habr.com/ru/post/1303466/


All Articles