Replies: 7   Views: 4189
How to integrate phpdocx with yii framework?
Topic closed:
Please note this is an old forum thread. Information in this post may be out-to-date and/or erroneous.
Every phpdocx version includes new features and improvements. Previously unsupported features may have been added to newer releases, or past issues may have been corrected.
We encourage you to download the current phpdocx version and check the Documentation available.

Posted by vijay  · 16-09-2013 - 17:32

On a standalone php script, all I have to do to include phpdocx is 

require_once '../phpdocx_pro/classes/';

How do I include phpdocx in Yii? I've my files in components/thirdparty/phpdocx

Posted by admin-phpdocx  · 18-09-2013 - 08:43

There may be conflict with the autoloaders when you want to ingterate PHPDocX within a PHP framework.

We have explicitly worked it out with other frameworks like Simfony but not yet with Yii.

Anyhow we do not expect it to be an unsurmontable problem :-)

Let us have a look at it and we will get back toy you...

Posted by vijay  · 18-09-2013 - 15:50

That would be very helpful.  I'm not able to do much (for example, MergeDocx is also not working - because it can't find Yii's CException class). Thank You.

Posted by tarzip  · 14-11-2013 - 00:14

I hope you have found the solution.

In the start we also faced similar problem but this fixed teh issue.

in  config/main.php in 'import'
















and use following code where you create new CreateDocx or other PhpDocx object

require_once '/path-to-phpdocx/classes/';



require_once '/path-to-phpdocx/classes/';

Yii::registerAutoloader(array("AutoLoader", "load"));



Posted by jorgelj  · 14-11-2013 - 10:17


There's this post:

About how to integrate PHPDocX with Yii.


Posted by tarzip  · 14-11-2013 - 21:45

Thanks for reply.

At first we used the approach mentioned in your post but it failed. Then we added all the subpaths in yii import config variable and it worked and never tried again the other way.

I'll try the way you mentioned also. It will reduce 13 line to just 1 in YII import.

I see you are not using phpdocx autoloader. I'll reply back after using mix of your and ours config options to see if it works or not.



Posted by jorgelj  · 15-11-2013 - 07:37


This line:


imports the Autoloader. Of cource if you find any issue please write a post to check it.