
CodeIgniter 2.0 V/S CodeIgniter 3.0
CodeIgniter 2.0 V/S CodeIgniter 3.0
Codeigniter is a powerful PHP framework for building creative, fully-featured web applications. It’s popularly noted for faster, Lighter development compared to other frameworks. Codeigniter was released by Ellis labs in 2006. Its open-source code maintained at the GitHub Under MIT license. Last year it is released the 3.0 version.
Now we will look at 3.0 version updates by matching with the previous version 2.0 to see what changed.
PHP version Support
New CodeIgniter 3, doesn’t support PHP 5.1.6 anymore. It requires a minimum of 5.2.4 version. Best suggests using 5.4+ or newer versions to avoid problems in the future.
Output Minification
The new Output library has the capability to minify Javascript, CSS, and even your HTML output. It is compacting HTML code, including any inline JavaScript and CSS included in it which can preserve many bytes of data and speed up downloading, parsing, and execution time.
Minifying the HTML output
To eliminate useless whitespace from generated HTML just execute minify_output, config setting to TRUE in the config.php file.
$config[‘minify_output’] = TRUE;
Minifying the JS/CSS
To minify CSS or Javascript, you’ll need to add it into your Assets controller, or some other way that control your Assets and output them, not present them as static files. This happens because of the Output::minify() method.
- $css = $this->output->minify($style_content, ‘text/css’);
- $scripts = $this->output->minify($script_content, ‘text/javascript’);
New and updated mime Support
The list is the files that CI 3 has appended support for.
- Appended support for privacy improved mail, kdb,sst, cer, CSR Certs to mimes.php.
- Continued support for PGP, gpg, zsh files to mimes.php.
- Continued support for 3gp, 3g2, f4v, vlc, mp4, WMV Video files to mimes.php
- Continued support for m4a, xspf, au, aac, m4u, ac3, FLAC, Ogg, WMA Audio files to mimes.php.
- CI 3 has also renewed support for XML, XSL, doc, docx, PHP, zip, and CSV files in mimes.php.
Changes in Helpers
Date helper
- An optional third parameter is introduced to timespan() that restrains the number of time units represented is added.
- An arbitrary parameter is added to timezone_menu() that provides more attributes to be appended to the created select tag.
- An extra function date_range() is appended that creates a list of dates between a particularized period.
- Deprecated standard_date() function now just uses the native date() with Date&Time constants.
- Now() will work with all timezone strings backed by PHP.
URL helper
- Separator options dash and underscore for function url_title() is now depreciated.
- Function url_title() will now trim other dashes from origin and end.
- Function anchor_popup() will now fill the href attribute with the URL. JS of that code will pass FALSE instead.
- The anchor_popup() function has JS window name support and menubar attribute also.
- HTTP/1.1 response codes 303, 307 in redirect() has auto-detection.
- Modified redirect() to select the refresh method only on IIS servers, rather than all servers on Windows.
- Changed anchor(), anchor_popup() and redirect() to support protocol-relative URLs.
HTML helper
- Joined more doctypes.
- Modified application and environment config files to be arranged in a cascade-like style.
- Improved doctype() to cache and only load once the doctypes array.
- Depreciated functions nbs() and br(), which are just aliases for the native str_repeat()with and respectively.
Download helper
- Appended an optional third parameter to force_download()
- To support existing files to be renamed for download.
- To adequate utilize of available server memory.
- To serve multibyte filenames when possible, via the filename* attribute.
Form helper
- form_dropdown() will now take an array for unity with other form helpers.
- set_value() will now also receive a third argument, allowing to turn off HTML leaving the value.
CAPTCHA helper
- For customization of the produced word, word_length and pool options are appended.
- The configuration is the available background, border, text and grid colors, color customization.
- You can also customize the font size by font_size.
- An img_id option is also available to set the id characteristic of the captcha image.
Other changes
Codeigniter has made clusters of small changes for becoming more effective and to enhance functionality.
- Many database enhancements are done throughout the drivers.
- Many library changes are done, like appended a new Encryption Library to succeed the old, largely insecure Encrypt Library.
- Timestamps are now preserved in migration file names.
- Input library includes input_stream() to retrieve php://input stream data for better AJAX functionality.
- You can set document character set in Output::set_content_type() method.
Above are some of the high-level modifications and updates that arose with CodeIgniter 3. You can examine the full list in the official changelog here.