Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Framework helpers, what are they for?

I began looking at some frameworks. Particularly Code Igniter fascinated me. But searching trough the folders I found out system/helpers that contains 21 PHP files. Inside these files we find thousands of functions related to html, xml, strings, arrays, numbers, forms... etc.

This should be simple, but I really don't understand the meaning of these helper files. I mean: What is generally considered an helper? Are they required? Could I delete them without risks?

like image 678
Shoe Avatar asked Apr 06 '11 16:04

Shoe


1 Answers

A "helper" in many frameworks including CodeIgniter refers to a set of functions that make simple, routine tasks easier to accomplish by grouping multiple processes into a single function.

The official documentation for CodeIgniter helpers can be found here.

It provides the following explanation:

Helpers, as the name suggests, help you with tasks. Each helper file is simply a collection of functions in a particular category. There are URL Helpers, that assist in creating links, there are Form Helpers that help you create form elements, Text Helpers perform various text formatting routines, Cookie Helpers set and read cookies, File Helpers help you deal with files, etc.

A list of helper functions and what they do can also be found in the documentation.

Dan

PS. You should not delete any files in the system directory as they may be relied upon within the core. You can create your own helpers which are placed in the application/helpers directory.

like image 86
Dan Greaves Avatar answered Nov 11 '22 13:11

Dan Greaves