Contents
Should class file names be capitalized?
Class names should be nouns, in mixed case with the first letter of each internal word capitalized. Try to keep your class names simple and descriptive. Interface names should be capitalized like class names.
What are the file naming rule in PHP?
There is no really convention for PHP files. You just should keep the same in your project. I recommand you to use camelCase. There is no specific for the core php files you have to use your own naming convention, but you can name on the bases of you file work.
How do you name a class in PHP?
Class names are always written in UpperCamelCase . The unqualified class name must be meant literally even without the namespace. Class names must be nouns, never adjectives. The name of abstract classes must start with the word “Abstract”, class names of aspects must end with the word “Aspect”.
Is it possible to capitalize a name in PHP?
It appears that correctly normalizing name capitalization is an unsolvable puzzle. There is no consistency in name casing, or for any kind of name formatting for that matter. See Falsehoods programmers believe about names.
What should I name my PHP class file?
If you do this, then it follows that you would name the file MyClass.php. And MyClass.class.php works too. MyClass.class is a bad idea that could allow someone to view your source code if they request that file by name.
How to name classes, methods and variables in PHP?
Naming: FunctionNamesLike, $localVariableName, $objectVariable, ClassNamesLike, MethodNamesLike, CONSTANTS_LIKE_THIS. Global names (classes, functions, variables, defines) must be prefixed to prevent naming clashes with PHP itself. This approach includes preventing prefixes that clash with PHP or are likely to.
Is it bad practice to use capitals and spaces in filenames?
But if it ends-up having bad repercussions, you will remember that some told you in the past that using capitals and spaces in filenames is bad practice. And one last thing, if you want to avoid all problems, no special characters in filenames (only lower case letters, digits, underscore and minuses [1]).