CodeIgniter Forums
CI 2.x->3.x Class Names? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: Installation & Setup (https://forum.codeigniter.com/forumdisplay.php?fid=9)
+--- Thread: CI 2.x->3.x Class Names? (/showthread.php?tid=66609)



CI 2.x->3.x Class Names? - VikRubenfeld - 11-11-2016

I'm upgrading from CI 2.x to 3.x.  I see that I will be changing the case of class names to make them have initial caps. E.g.:

PHP Code:
application/libraries/mylibrary.php 

becomes:

PHP Code:
application/libraries/Mylibrary.php 

Question: do I also need to update references to that class in the code? E.g. do the following need to change as well?

PHP Code:
$this->load->library('mylibrary');

$this->mylibrary->myfunction(); 

...or, can I leave those unchanged?

Thanks in advance for the info


RE: CI 2.x->3.x Class Names? - Wouter60 - 11-11-2016

You can leave those in lower case.
But you do have to rename the classes inside the corresponding php files.

So the file Mylibrary.php must start with:

PHP Code:
<?php
class Mylibrary 



RE: CI 2.x->3.x Class Names? - VikRubenfeld - 11-11-2016

Excellent. Thanks very much.


RE: CI 2.x-&gt;3.x Class Names? - Narf - 11-11-2016

(11-11-2016, 11:33 AM)Wouter60 Wrote: You can leave those in lower case.
But you do have to rename the classes inside the corresponding php files.

So the file Mylibrary.php must start with:

PHP Code:
<?php
class Mylibrary 

Should, but not really required. It will work just fine with renaming only the files.


RE: CI 2.x-&gt;3.x Class Names? - wolfgang1983 - 11-11-2016

http://www.codeigniter.com/user_guide/general/styleguide.html#file-naming