Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP file naming conventions (.class, .inc)

I see .class and .inc included in file names a lot of the time. My current understanding is that this is just a best practice to make the purpose/contents of the file clear.

Is there any instance in PHP where a .class or .inc file name has a special purpose and truly means something?

like image 903
Brian Avatar asked Dec 08 '09 14:12

Brian


1 Answers

As far as the PHP interpreter is concerned there's no behavioural reason to include these descriptors at all. The de facto convention seem to be, to include them as part of the file suffix however I find it more useful to prefix them - i.e. my file names tend to look like:

class.*.php
inc.*.php
tpl.*.php

This is purely for organisational purposes; Whenever an application / terminal lists them in alphanumerical order each "type" will be grouped together. To conclude the question though it's really just down to preference, the only thing that's important - whatever you choose - is consistency.

like image 140
Emissary Avatar answered Sep 22 '22 14:09

Emissary