Helpers are functions that help in your code. There are some helpers in codeigniter 4 like html helper, URL helper, from helper, text helper, cookie helper and many more. The work of all helpers is different. Such as linking css files in html helper work view file, creating URL helper work link, form helper's work building form.
We can also make helper custom. Who does his according work.
The custom helper we save is named filename_helper.php. Create this file in a folder containing helpers.
// helper expample
user_helper.php
profile_helper.php
admin_helper.php
helpers/user_helper.php
helpers/profile_helper.php
helpers/admin_helper.php
The helper can also be loaded anywhere in the controller. For example:
// load single helper in controller
helper('text');
helper('from');
helper('url');
// text helper example
echo word_limiter('my name is deepak tailor',4);
// output : my name is deepak...
// from helper example
echo form_open('home/submit_form');
echo form_close();
// url helper example
echo base_url();
// output : my name is deepak...
// load multiple helpers in controllers with array
helper(['text','from','url']);
My name is Deepak tailor as a fullstack developer. I have been in the IT industry (PHP, Nodejs, flutter) for the last 5 years. For professional and customize web development & app development, you can send inquiry on our email.
----
You can contact him at deepaktailor10@yahoo.in