The simple way to add composer into Codeigniter 3

The simple way to add composer into Codeigniter 3

In this post we will show you simple way to add composer into Codeigniter 3, hear for simple way to add composer into Codeigniter 3 we will give you demo and example for implement.

how to add composer into Codeigniter 3

The writer is a reliance director for PHP. It encourages you to effectively coordinate outsider libraries in your ventures. Adding arranger to your CodeIgniter extend is simple. Before beginning the means for author combination in CodeIgniter you have to ensure that arranger is introduced in on your PC. You can download writer from the accompanying connection Download Composer. Writer establishment methodology is practically straight forward and I don’t surmise that I have to clarify that here.

    • Now the means for adding arranger to your CodeIgniter project
    • First duplicate and glue composer.json document in the venture envelope to the application organizer

      Second in the config.php document $config['composer_autoload'] = TRUE;

  • That is it, you effectively incorporated arranger in your CodeIgniter extend. For better elucidation, i will demonstrate to you a case generally accepted methods to introduce mpdf utilizing author.

    • Open cmd and direct to application folder
    • Inside application index Type writer require mpdf/mpdf
  • Presently a merchant organizer will be made inside application envelope and inside seller organizer you can see every one of your bundles downloaded by author.

how to add composer to Codeigniter 3
how to add composer to Codeigniter 3

Presently since you autoloaded writer now you can simply utilize the code given by mpdf official manual like:
function m_pdf()
{
	$mpdf = new mPDF();
	// Write some HTML code:
	$mpdf->WriteHTML('Hello World');
	// Output a PDF file directly to the browser
	$mpdf->Output();  
}

Keep in mind you don’t have to sort require_once APPPATH.’/merchant/mpdf/mpdf/mpdf.php’; since you as of now autoloader author.

On the off chance that you not want to autoload writer you should sort require_once APPPATH.’/merchant/mpdf/mpdf/mpdf.php’ toward the start of every controllers where you utilize the mpdf seller libraries.

Presently you can undoubtedly incorporate a great many most recent open source PHP libraries in only a single tick. You can peruse all bundles author has by going to https://packagist.org/.

Hope this code and post will helped you for implement simple way to add composer into Codeigniter 3. if you need any help or any feedback give it in comment section or you have good idea about this post you can give it comment section. Your comment will help us for help you more and improve onlincode. we will give you this type of more interesting post in featured also so, For more interesting post and code Keep reading our blogs onlincode.org

Leave a Comment

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

88  +    =  94

We're accepting well-written guest posts and this is a great opportunity to collaborate : Contact US