Date Added: 31/10/2017
Codeigniter 3 upper(ucwords) first letter of filename  for libraries,controllers,models

Starting with CodeIgniter 3.0, all class filenames (libraries, drivers, controllers and models) must be named in a Ucfirst-like manner or in other words - they must start with a capital letter

 

code below finds all php files in "application/models/" rename  Ucfirst-like manner (product.php -> Product.php)

 //// CODE ////

$this->load->helper('directory');

$m_d=$_SERVER['DOCUMENT_ROOT']."/application/models/";

$m_f=directory_map($m_d,1,false);

foreach ($m_f as $f){

if(preg_match("/(.*)\.php$/",$f)){

//echo $m_d.ucwords($f)."
";

rename($m_d.$f,$m_d.ucwords($f));

}

}

  //// CODE ////

Last Update: 19/12/2017 Posted by: müslüm ÇEN

Not Commented Yet !
Please login in order to comment . Login