• Home
  • Create Plugins
  • Contact Us
  • Demo
    Installation & MaintenancePersonalizationSettingsClient ManagementInvoices & PaymentsProjects & TasksTeam & CollaborationProductivity ToolsSales & ServicesPluginsFAQChange logs
  1. Docs
  2. Plugins

Common working processes in plugins

Visit the official documentation of CodeIgniter for advanced information.

  • Routes: Specify the routes to detect plugin from main app.
<?php
namespace Config;

$routes = Services::routes();

$routes->get('my_plugin', 'My_Plugin::index', ['namespace' => 'My_Plugin\Controllers']);
$routes->get('my_plugin/(:any)', 'My_Plugin::$1', ['namespace' => 'My_Plugin\Controllers']);
$routes->post('my_plugin/(:any)', 'My_Plugin::$1', ['namespace' => 'My_Plugin\Controllers']); //will be required if any data need to be posted


  • Controllers:
<?php

namespace My_Plugin\Controllers;

use App\Controllers\Security_Controller; //access main app's controller

class My_Plugin extends Security_Controller {
    //your methods
}

  • Models:
<?php

namespace My_Plugin\Controllers;

use App\Models\Crud_model; //access main app's models

class My_Plugin_Model extends Crud_model {
    //your methods
}  

Calling the model:

  $My_Plugin_Model = new \My_Plugin\Models\My_Plugin_Model();


  • Libraries:
<?php

namespace My_Plugin\Libraries;

class My_Plugin_Library {
    //your methods
}

Calling the library:

  $my_plugin_library = new \My_Plugin\Libraries\My_Plugin_Library();


  • Languages: Follow the same directory design for languages. Like My_Plugin/Language/english/custom_lang.php and default_lang.php. Remember to add a unique prefix with your language key. Here has an example:
<?php

$lang["my_plugin_show_staff_members"] = "Show staff members";

Then you can use the RISE's app_lang("my_plugin_show_staff_members"); to retrieve the language value. Add all language directories as like the main app if you wish to support all language for your plugin.


  • Views:
$view_data['foo'] = "bar";

//$this->template->rander() function will show the view with left menu and topbar by default.
return $this->template->rander('My_Plugin\Views\folder\index', $view_data);

//$this->template->view() function will show only the view, but here you'll get the login user's info as $login_user variable if any login user exists
return $this->template->view('My_Plugin\Views\folder\index', $view_data);

//default view() function of CI
return view('My_Plugin\Views\folder\index', $view_data);


  • Helpers: Add an helper file in My_Plugin/Helpers folder (like my_plugin_general_helper.php) and call it like this:
  helper("my_plugin_general_helper");


  • ThirdParty: Load a third party file like this:
  require_once(PLUGINPATH . "My_Plugin/ThirdParty/library_folder/vendor/autoload.php");


  • Loading assets:
  <link rel='stylesheet' type='text/css' href='" . base_url(PLUGIN_URL_PATH . "My_Plugin/assets/css/my_plugin_styles.css") . "' />

  • File management: Follow the same workflow as we're doing now for file management. Only change the target directory to this:
  PLUGIN_URL_PATH. "My_Plugin/files/my_plugin_files/"


Was this article helpful? Yes No
How can we improve this article?
© 2026 Fairsketch
Home 3rd Party Plugins Get Support Buy Now

Delete?

Are you sure? You won't be able to undo this action!
To do