Following are the step to upgrade your legacy CodeIgniter 2.x application into CodeIgniter 3.x application. CodeIgniter 3.x supports new versions of PHP and has more security and faster execution.
Go to system folder replace all files and directories in your system/ directory and replace your index.php
file.
If any modifications were made to your index.php
they will need to be made fresh in this new one.
if you have any custom developed files in system folder please make a copy of them first.
The Log Class is considered as a core class and is now located in the system/core/ directory. Therefore, in order for your Log class overrides or extensions to work, you need to move them to application/core/:
application/libraries/Log.php
-> application/core/Log.php
application/libraries/Input.php
-> application/core/Input.php
In Codeigniter 3.x all class filenames (controllers, model, drivers, libraries) must start with a capital letter. For examples:
application/libraries/mylibrary.php
-> application/libraries/Mylibrary.php
application/controllers/welcome.php
-> application/controllers/Welcome.php
application/models/welcome_model.php
-> application/models/Welcome_model.php
mimes.php
config file has been updated in 3.x to contain more user mime-types. Please replace mimes.php config file with new 3.x codeigniter mimes.php config file.
The Session Library has been completely re-written in CodeIgniter 3 and now comes with a new features.
$this->session->unset_userdata(array('name' => 'abc', 'email' => '[email protected]')); -> $this->session->unset_userdata(array('name', 'email'));
In CodeIgniter 3.x the error templates are now considered as views and have been moved to the application/views/errors/html directory. Furthermore in Codeigniter 3.x, there is support for CLI error templates in plain-text format that unlike HTML. You can move your old files from application/errors to application/views/errors/html but you have to copy the new application/views/errors/cli directory from the CodeIgniter 3.x and past into application/views/errors/cli directory.
In Codeigniter 3.x renaming of Active Record to Query Builder inside your config/database.php.
you will need to rename the $active_record variable to $query_builder with true value.
// $active_record = TRUE;
$query_builder = TRUE;
CodeIgniter has always provided the :any wildcard in routing. In Codeigniter 2.x the :any wildcard is represent with .+.
This is considered a bug as it also matches the / (forward slash) character which is the URI segment delimiter.
In CodeIgniter 3 the :any wildcard will now represent [^/]+, so that it will not match a forward slash.
In Codeigniter 3.x the IF EXISTS condition is no longer added by default and has an optional second parameter [TRUE]
and is set to FALSE by default.
$this->dbforge->drop_table(‘table_name’); -> $this->dbforge->drop_table(‘table_name’, TRUE);
Many methods and functions now return NULL instead of FALSE when the required items don’t exist.
uri->segment(), session->flashdata();
In Codeigniter 3.x previously deprecated SHA1 library has been removed now your code to use PHP’s native sha1() function to generate a SHA1 hash.
In 3.x, Codeigniter now uses PHP native hash() function instead of do_hash() function.
In Codeigniter 3.x now uses trim() function instead of trim_slashes().
In Codeigniter 3.x now uses html_escape() function instead of form_perp() function.
Date Helper function standard_date() is being deprecated in Codeigniter 3.x due to the availability of native PHP constants. Which when combined with date() function provide the same functionality.
You can email to discuss with CodeIgniter expert to update your 2.x application to a newer 3.x and 4.x versions.
Our support staff is available 24/7 to take support calls and messages from clients.
We involve client in all stages of software development to deliver satisfaction and peace of mind.
We hire developers that are technically strong and discuss the project thoroughly before starting.
If you are not happy with the quality of work or we fail to achieve final technical goal, we’ll not take your money.
We have worked with some clients for over 7 years. Our commitment and dedication is a matter of pride for us.
We care about your investment. We will tell it straight if you are making a bad decision.
NDA implied. No spam. Privacy guaranteed.
Best web, app, eCommerce and custom software development company. We provide services to more than 100 clients world-wide.
Contact The Right Software today to discuss the your next big idea.