Pregunta

I need to integrate TCPDF as third party library in Symfony 2.1.

I tried in composer.json like

"repositories": [
    {
        "type": "vcs",
        "url": "git://tcpdf.git.sourceforge.net/gitroot/tcpdf/tcpdf"
    }
],
"require": {
    "tcpdf/tcpdf":"*"
},

But it gives an error The requested package tcpdf * could not be found.

How to give third party libraries correct in composer.json file?

TCPDF library don't follow namespaces, so how we can access this library in our bundle?

¿Fue útil?

Solución

The reason it's not found is that the package name in the tcpdf repo is tecnick.com/tcpdf, so that's what you should require.

That said, since it's available on packagist you don't need to add the vcs repository at all in your composer.json.

Otros consejos

There are several packages related to TCPDF on Packagist — some of them are bundles to integrate it with Symfony.

Since tcpdf does not support composer you need to use the package repository. The docs for this is available at:

http://getcomposer.org/doc/05-repositories.md#package-2

Do note that their example configuration has both dist and source where source is what you need. You will probably also need to configure the autoloading to match that of tcpdf. You can find documentation on that on the composer website as well.

A good thing would also be to send the tcpdf authors an email and ask them if they don't mind adding a composer.json.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top