Home >Backend Development >PHP Tutorial >laravel - What should the standardized PHP class library naming look like?
I have seen many open source projects in the form of class.classname.php, but I have also seen many frameworks in the form of classname.class.php. Where should I place this class?
I personally prefer the .class.php form, because in some frameworks, when importing third-party class libraries, the specified class library suffix can be directly specified as .class.php
I have seen many open source projects in the form of class.classname.php, but I have also seen many frameworks in the form of classname.class.php. Where should I place this class?
I personally prefer the .class.php form, because in some frameworks, when importing third-party class libraries, the specified class library suffix can be directly specified as .class.php
*.config.php
*.function.php
*.class.php
The above is suitable for small code, everything is placed in one directory.
If not, such a filename is not needed.
It is recommended to learn about php's psr-4: https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-4-autoloader.md
This is all a matter of usage habits. It is better to write according to PSR-4
. After all, composer
automatically generates the mapping relationship between the namespace and the source file for you, which is very convenient to use
I personally think that if it is a php file
then it should end with php
There is no need to distinguish between types of files, configuration files, function files
If you want to see it, it is best to look at http:// The projects above packagist.org/
should all end in php!