How to use external php library in codeigniter? |
The problem is that CI can find the 'caxy/htmldiff/htmldiff' file, but cannot find any of the files it needs to load.
My suggestion is to install caxy/php-htmldiff using Composer as described on their Readme page. Then in the file /application/config.config.php use the following setting in the Composer auto-loading section PHP Code: $config['composer_autoload'] = FCPATH.'vendor/autoload.php'; In the controller that will load and use htmldiff put the following immediately after the opening PHP tag, e.g. PHP Code: <?php Do not use PHP Code: $autoload['libraries'] = array( 'caxy/htmldiff/htmldiff'); You should not use $this->load->library(). either. Instead, when you want to instantiate HtmlDiff use "new". Below I create a class property to hold the HtmlDiff object when you create one. In this example I do so in the compare method PHP Code: <?php If you want to use a HtmlDiffConfig Object include the following line right after the first "use: statement PHP Code: use Caxy\HtmlDiff\HtmlDiffConfig; |
Messages In This Thread |
How to use external php library in codeigniter? - by HarrysR - 09-08-2019, 01:42 PM
RE: How to use external php library in codeigniter? - by dave friend - 09-08-2019, 02:41 PM
RE: How to use external php library in codeigniter? - by HarrysR - 09-08-2019, 02:52 PM
|