2

I have install setasign/fpdi on my Symfony, I create a class for generate a PDF :

class MerchPDF extends \FPDI {.... }

and I have this error :

Attempted to load class "FPDI" from the global namespace. Did you forget a "use" statement?

on local, no problem. on production, there is this error ... and all files are equals.

Are you an idea ?

Thanks

Gazouweb
  • 33
  • 5

2 Answers2

1

If you require setasign/fpdi as a composer dependency, the base Fpdi class is not available in the global namespace, but in setasign\Fpdi namespace. So your class should start like this:

use setasign\Fpdi\Fpdi;

class MerchPDF extends Fpdi {
    ...
}

Not sure why it works locally, probably you have installed Fpdi by other means (i.e. not via composer) so it's available as a class in the global namespace.

Francesco Abeni
  • 4,190
  • 1
  • 19
  • 30
0

please have you already try to remove both TCPDF (if it is installed too) and FPDI from the classmap of the composer.json. Then add both: "tecnick.com/tcpdf": "dev-master", "setasign/fpdi": "1.4.2(here the version)", To the "require" part of the composer.json ?