E
E
Elena2015-06-11 12:51:54
symfony
Elena, 2015-06-11 12:51:54

How to connect a third-party library to your symfony project?

The background is this: in a symfony application, you need to send notifications to ios, android. I want to use the GCMMessage and ApnsPHP libraries. Composer downloaded them without problems in vendors.
The catch is how to use them in a particular place. There are no problems with GCMMessage - just write use , but ApnsPHP uses its own ApnsPHP_Autoload. How to embed it in symfony without editing the code of the library itself?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Denis, 2015-06-11
@lenk0belk0

composer.json

"autoload": {
        "psr-0": { "": "src/", "ApnsPHP" : "vendor/duccio/apns-php/" }
    }

<?php

namespace Acme;

class Test 
{
    public function __construct()
    {
        new \ApnsPHP_Message_Custom();
    }
}

...and yes, you are linking libraries not to Symfony, but to your project.

M
matperez, 2015-06-11
@matperez

It looks like it's already loaded. There, at the end, the autoloader is added from its own autoloader.
https://github.com/immobiliare/ApnsPHP/blob/master...
Have you tried how to use it?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question