Codeigniter Create custom library

Today, We want to share with you Codeigniter Create custom library.In this post we will show you how to use any library in codeigniter, hear for codeigniter load library in controller we will give you demo and example for implement.In this post, we will learn about How to create custom library file in codeigniter 3 with an example.

Codeigniter Create custom library

There are the Following The simple About Codeigniter Create custom library Full Information With Example and source code.

As I will cover this Post with live Working example to develop how to create plugin in codeigniter, so the create custom library codeigniter Directory structures for this example is following below.

Create a CodeIgniter Libraries

Step 1:-Create Custom Library

first of all you Go to application/libraries as well as here create a new file Yourfilename_lib.php like as a Convertlibrary.php.



CodeIgniter load pre-defined libraries


class Convertlibrary{
    private $CI;
    public function __construct()
    {
        $this->CI =& get_instance();
        $this->CI->load->helper('url');       
        $this->CI->load->database();
        
    }

   function show()
    {
        // Your main logic
    }
}

CodeIgniter load the library


    $this->load->library('convertlibrary');

Step 3: your library method in controller (In any controller)


$this->convertlibrary->show();

Web Programming Tutorials Example with Demo

Read :

Summary

You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about Codeigniter Create custom library.
I would like to have feedback on my infinityknow.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

Leave a Comment