Domanda

I'm trying to properly add FPDF to my Symfony 2.3.4 project as a third party library under the vendor directory. I was mainly following this blog post. But I can't get it to work.

First of all, I'm not really sure what the vendor name and the library name is in this example. So let's say vendor is OlivierPlathey (the author of FPDF) and the library is FPDF, I'd create the wrapper class under /vendor/olivierplathey/lib/FPDF/FPDF.php, right? But what would the class name be? According to the blog post it should be OlivierPlathey_FPDF, but I think it has to be OlivierPlathey_FPDF_FPDF, because the library is called FPDF and the class inside that library is also called FPDF.

Secondly, there is no method registerPrefixes, because my project (for whatever reason) uses the Composer\Autoload\ClassLoader class, so I changed that to $loader->add('OlivierPlathey_FPDF', __DIR__.'/../vendor/olivierplathey/lib/FPDF'). Again, I have no idea what the correct prefix and path are. I think I tried all possible combinations I could think of, but none of them work.

I also tried adding a composer.json file, but nothing seems to have any effect.

Can anyone point me in the right direction here? Is there some way to at least get an idea of where the class loader is looking??

È stato utile?

Soluzione

please dont do these kind of stuff, go on packagist and find the right package to install with composer command line interface. Class loader will be overwritten each time you'll use composer anyway,you shouldnt be touching it.

https://packagist.org/search/?q=FPDF

If you dont know how to use composer read its doc

https://getcomposer.org

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top