3.5. CodeIgniter Helpers
Helpers, as their name implies, help you with specific tasks. Unlike libraries, helpers are not object-oriented but procedural in nature. Each helper contains one or more functions, each focusing on a specific task, with zero dependence on other functions.
Helpers can either be loaded locally or autoloaded in /system/application/config/autoload.php. CodeIgniter ships with the following built-in helpers:
Array — The Array helper contains functions that help you work with arrays. For example, the random_element() function takes an array as input and returns a random element from it.
Cookie — The Cookie helper contains functions that help you set, read, and delete cookie data.
Date — The Date helper contains functions that help you work with dates. For example, the now() function returns the current time as a UNIX time stamp.
Directory — The Directory helper contains a single function that helps you work with directories. For example, the directory_map function reads a specified directory path and builds an array of it that contains all of its files and subdirectories.
Download — The Download helper contains a single function that helps you download data easily. The force_download() function generates server headers that force data to be downloaded instead of viewed in a browser.
File — The File helper contains functions that help you read, write, and delete files.
Form — The Form helper contains functions that help you build forms. It is probably one of the most ...
Get Professional CodeIgniter® now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.