Codeigniter Create custom library

Codeigniter php Programming Technology

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.

List of all Google Adsense, VueJS, AngularJS, PHP, Laravel Examples.

Snippet Contents

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.

<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
 * CodeIgniter
 *
 * An open source CodeIgniter application development framework for PHP 7.1 or newer
 *
 * @package     CodeIgniter
 * @author      pakainfo
 * @copyright           Copyright (c) 2021, pakainfo.
 * @license     
 * @link        https://www.pakainfo.com
 * @since       Version 1.0
 * @filesource
 */

// ------------------------------------------------------------------------

/**
 * pakainfo core CodeIgniter class
 *
 * @package     CodeIgniter
 * @subpackage          Libraries
 * @category            pakainfo
 * @author      pakainfo
 * @link        https://www.pakainfo.com
 */

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.


Related FAQ

Here are some more FAQ related to this Article:

  1.   PHP Merge Multiple PDF Files with Ghostscript
  2.   CodeIgniter Create Custom Helper Example Tutorial
  3.   Laravel Drop all tables with MySQL
  4.   Laravel DataTables Server side Processing Example
  5.   PHP Laravel REST APIs Tutorial with MySQL
  6.   Autocomplete with Search box in vuejs Demo
  7.   PHP stdClass object Array Examples with scripts
  8.   Codeigniter delete query from Database
  9.   Create A Setup File In Visual Studio 2015
  10.   Jquery Ajax POST Request in Laravel refresh csrf token

Leave a Reply

Your email address will not be published. Required fields are marked *