1

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??

1

1 Answer 1

2

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

Sign up to request clarification or add additional context in comments.

2 Comments

So that means I just need to add "itbz/fpdf": "dev-master" to my project's composer.json and do a php composer.phar update itbz/fpdf?
I tried that, but I get an error: Your requirements could not be resolved to an installable set of packages. Then it complains about icu: symfony/icu v1.2.0 requires lib-icu >=4.4 -> the requested linked library. But why? I only want to install fpdf

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.