CodeIgniter Forums
Naming convention for third party classes - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: Best Practices (https://forum.codeigniter.com/forumdisplay.php?fid=12)
+--- Thread: Naming convention for third party classes (/showthread.php?tid=86678)



Naming convention for third party classes - brucehvn - 02-09-2023

I'm working with CI 3.1.x which requires that all classes follow the naming convention of first letter UC and the rest lower case.
If I have third party libs installed directly or via composer and they do not follow that naming convention, will I have to modify them to conform, or is it more of just a convention to follow, but is somewhat optional?


RE: Naming convention for third party classes - InsiteFX - 02-10-2023

It's just a convention to follow, you can use which ever way you like.


RE: Naming convention for third party classes - JackToncatridr - 02-27-2023

The naming convention in CI 3.1.x, where classes should have the first letter in uppercase and the rest in lowercase, is a convention that should be followed but it is not strictly enforced. It is a good practice to follow this convention as it makes your code easier to read and understand, especially for other developers who may work on your project.

However, if you are using third-party libraries that do not follow this convention, you do not necessarily have to modify them to conform. You can still use them as is, but you should be consistent with your own code and follow the convention as closely as possible. In some cases, you may need to modify the library code to work with CI 3.1.x, but this should only be done if absolutely necessary and with caution to avoid introducing any bugs or breaking the library's functionality.