Search code examples
phpsymfonysymfony-2.1composer-phppackagist

How to give third party libraries in composer.json in Symfony 2.1 and access library in our bundle?


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?


Solution

  • 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.