找不到xml类

I am trying to work with fluidxml to test if I can use it, but I cant get it to start working, I am using codeigniter framework. I cloned the repo https://github.com/servo-php/fluidxml and added it to a folder I created called thirdparty. Then here is the code for the function

public function xmltrial(){
        $this->load->helper('file'); 
        require_once(APPPATH.'third_party/fluidxml/source/FluidXml.php');

        $book = new FluidXml();
        $book->add([ 'title'  => 'The Theory Of Everything',
             'author' => 'S. Hawking',
             'chapters' => [
                    [ 'chapter' => [
                            '@id' => '1',
                            '@'   => 'Ideas About The Universe' ] ],
                    [ 'chapter' => [
                            '@id' => '2',
                            '@'   => 'The Expanding Universe' ] ],
           ]]);

        echo $book;
    }

So I am getting two errors , one is Fatal error: Class 'FluidXml' not found even and the second one is if I use use function \FluidXml\fluidxml; use function \FluidXml\fluidns; use function \FluidXml\fluidify; all this character inside my xmltrial function it shows a red error on them.

You should use composer to manage your dependencies. Get composer installed, then install FluidXml into the vendor folder by typing

composer require servo/fluidxml

in the command line. Then you can

require_once 'vendor/autoload.php'

in your index.php, and you can forget about having to require in the files! You just need to put the relevant use statement under your namespace declaration.In your case,

use FluidXml\FluidXml;

Now you can start calling your class!

See Packagist for composer package details https://packagist.org/packages/servo/fluidxml

See Composer site to get composer into CodeIgniter if you don't already https://getcomposer.org/