First of all, I completely agree with you when you say that all PHP files should have ".php" as the final extension; Two reasons for this:
- as you stated, this helps prevent the extraction of unreviewed files.
- it also helps with IDEs / editors that do syntax coloring based on the file name: you do not need to configure it to treat ".inc" as a PHP file.
There are times when I do otherwise; the main reason for this is that I use a tool (CMS, Framerwork, library, ...) that has some rules about file names: I try to follow them even if I don't like them.
For example:
- With Drupal, I use ".inc", ".module", ".install", ...
- With the Zend Framework, I use ".phtml" for view scripts (HTML + PHP)
For files containing classes, I don't like ".class.php": I think this is a bit redundant; I use "MyClassName.php" and use this for autoload.
(BTW that those frameworks like Zend Framework or Doctrine ORM recommend)
As a support: you say that you are not a big fan of autoloaders; What for? I use them as much as I can:
- usually better for performance: only the code you really use is loaded / parsed /
- less code to write (no
require / include )
Pascal martin
source share