如何使用Codeigniter的第三方类

So I must be having a brain fart and need a hand. I'm trying to use BoxPacker in my Codeigniter project to figure out how many items I can fit in some boxes. I've installed BoxPacker into a "application/third_party/boxpacker" folder. But now how do I actually use it?

For some reason my brain is telling me I have to make my own library to interface with the third party programming but then I just have another brain fart and have no clue how to implement it. It's been a long week so I'm pretty burnt out and looking for a hand.

EDIT: So, I created a library named BoxPacker.php with the following code: `

class BoxPacker
{
    function __construct()
    {
        require_once APPPATH."third_party/boxpacker/vendor/autoload.php";
    }
}

In my controller I then call:

$this->load->library('BoxPacker'); $packer = new BoxPacker();

But when I try using the functions in the third part code like below, I get the following error Exception: Call to undefined method BoxPacker::addBox():

$packer->addBox(new TestBox('Le petite box', 300, 300, 10, 10, 296, 296, 8, 1000));

Besides installing the third party library in your application/third_party directory, you must create a new library in application/libraries that requires the third party code and extends it like this:

Application/libraries/Yourlib.php:

<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
    // include the 3rd party class
    require_once APPPATH."/third_party/class_name/filename.php";

    // Extend the class so you inherit all functions, etc.
    class NewClass extends ThirdPartyClass {
        public function __construct() {
            parent::__construct();
        }
        // library functions
        public function something(){
            ...code...
       }

Then, on your controller you must load the new library with:

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

After doing this, you may $this->yourlib as normal