Forum


Replies: 16   Views: 8637
Installation with composer
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 smartbit  · 08-12-2014 - 15:44

Is it possible to require PhpDocX with composer? So we can use autoloading? If I browse packagist.org for phpdocx, I stumbled upon this: https://packagist.org/packages/phpdocx/phpdocx But I don't know if it is legit. We have a Corporate licence.

Posted by admin  · 09-12-2014 - 11:41

Hello, No, that package is not legit. You can include phpdocx as any other external library with composer. This is a quick guide using the namespace package (only for Corporate and Enterprise licenses): 1) Extract the package to the vendor/phpdocx folder 2) Add this line in the autoload option of your composer.json: "files": [ "vendor/phpdocx/Classes/Create/CreateDocx.inc" ] 3) Update the composer autoloader: php composer.phar dump-autoload 4) You can use the library: $docx = new \Phpdocx\Create\CreateDocx(); $docx->addText('This is a test'); $docx->createDocx('Sample'); Regards.

Posted by laurent.ehrsam@reborn.lu  · 15-12-2014 - 13:42

hello, I tried to install phpdocx with composer following this method but I encountered 2 issues : 1/ During a composer update I had : PHP Warning: require(....vendor/phpdocx/Classes/Create/CreateDocx.inc): failed to open stream: No such file or directory That one was easy, as the CreateDocx.inc is not located in that directory, I corrected the line in my composer.json by vendor/phpdocx/classes/CreateDocx.inc 2/ But composer update is still crashing. I have now : Runtime Notice: Declaration of FPDF::_putstream() should be compatible with TCPDF::_putstream($s, $n = 0) in ....vendor/phpdocx/lib/fpdi/fpdi2tcpdf_bridge.php line 167 I'm stuck and I don't know what to do to correct that one, as the error is in your 3rd party lib. Is it a known bug ? FOI I'm using phpdocx in a Symfony 2.5 environement on an ubuntu server and I have a corporate licence. Best regards

Posted by admin  · 15-12-2014 - 15:21

Hello, You need to use the namespaces package, not the package without namespaces. You can download it from your account. And about 'Runtime Notice'; it's not an error but a notice. You can avoid that messages in the Symfony config or PHP env. Regards.

Posted by laurent.ehrsam@reborn.lu  · 16-12-2014 - 09:20

Hello, Thanks for your answer, but ... 1/ I use now the namespace version but I had to put "vendor/phpdocx/Classes/Phpdocx/Create/CreateDocx.inc" in my composer.json to make it work. (Phpdocx was missing), that's right, isn't it ? 2/ As our security and quality policy is very high, I'm not allowed to disable notices on the server. I'm aware it's "just" a notice and not an error but the composer update crashes like if it was a fatal error. Do you have a solution for me to make it work ? maybe an htaccess file at the top direcotry of phpdocx to avoid notices only in this lib ? thanks best regards

Posted by admin  · 16-12-2014 - 12:57

Hello, Yes, Phpdocx was missing from the string. About composer, htaccess are valid only for Apache, so you could remove the content of the fpdf folder if you won't use the merge class or set the error level when you invoke PHP-CLI; something as: php -d error_reporting=E_WARNING composer.phar Regards.

Posted by lclemenson  · 16-04-2015 - 08:01

Hello, I had both mistakes and I could fix the first one too but I'm stuck with the second one. It's probably stupid but I can't find the fpdf folder. Could you give me the exact path to it.. Thanks for your help

Posted by admin  · 16-04-2015 - 08:27

Hello, You can find it in the lib folder. Regards.

Posted by lclemenson  · 16-04-2015 - 15:40

In the lib folder I have the following folders but no fpdf folder : - dompdfParser - fpdf-tpl - fpdi - htmlawed - log4php - OdfConverter - openoffice -pdf I have tried to remove the files in the fpdf-tpl folder without success. Am I missing something ? Regards

Posted by admin  · 16-04-2015 - 16:22

Hello, What notice do you exactly see? Please post the full ouput. Regards.

Posted by lclemenson  · 16-04-2015 - 16:30

Edited by lclemenson · 16-04-2015 - 17:17
Hello, I see : Vendor > lib > and then all the folders I have listed : - dompdfParser - fpdf-tpl - fpdi - htmlawed - log4php - OdfConverter - openoffice -pdf + the following files in that folder : convert.php convertSimple.php MhtFileMaker.php UniversalClassLoader.php and VFXP.in.php When I update the composer I get that error : [ErrorException] Runtime Notice: Declaration of FPDF::_putstream() should be compatible with TCPDF::_putstream($s, $n = 0) in C:\wamp\www\recrutement\vendor\phpdocx\lib\fpdi\fpdi2tcpdf_bridge.php line 167 Regards

Posted by admin  · 16-04-2015 - 18:01

Hello, You can find the FPDF classes in the folders fpdi and fpdf-tpl (this are LGPL packages from FPDF). If you need the TCPDF class, please check into the pdf folder. Regards.

Posted by tmarini  · 08-05-2015 - 21:08

Hello, Did you ever get the exception cleared? If so, how? I am using composer with Laravel 5. composer update is fine but when I call: $docx = new \Phpdocx\Create\CreateDocx(); I get: ErrorException in fpdi2tcpdf_bridge.php line 2: Declaration of FPDF::_putstream() should be compatible with TCPDF::_putstream($s, $n = 0) If you could help that would be awesome! Thanks in advance!

Posted by admin  · 10-05-2015 - 11:07

Hello, Please download the latest package on MYPHPDOCX page after login. This notice and others were fixed some days ago. Regards.

Posted by ragboy  · 30-06-2015 - 15:56

I am getting this error with namespace version 4.6.3 (just downloaded today from my phpdocx) and Laravel 4.2 with composer setup as described: ErrorException (E_STRICT) Declaration of FPDF::_putstream() should be compatible with TCPDF::_putstream($s, $n = 0) I have downloaded the latest, any other suggestions?

Posted by ragboy  · 30-06-2015 - 16:08

UPDATE: I have deleted the lib/fpdi folder and so far so good, but I want to get that back in.

Posted by admin  · 30-06-2015 - 16:46

Hello, Thanks for the notification. Please edit the file lib/fpdi/fpdi2tcpdf_bridge.php and change this line: function _putstream($s) { to: function _putstream($s, $n = 0) { and try again. Regards.