My webapp has a buch of modules. Each module has a \'main\' php script which loads submodules based on a query sent to the main module:
//file: clientes.php
An alternative to defining a constant and checking it is to simply put the files that index.php includes outside of the document root area. That way the user can't directly access them via your web server at all. This is also obviously the most secure way, in case your web server has a configuration error in future that eg. displays PHP files as plain text.