Closed Coffee2CodeNL closed 8 years ago
Have you defined a client in your configuration? So in the README.md we are defining two clients called "api_payment" and "api_crm". You have to use the same name to use this service.
For example:
$client = $this->get('guzzle.client.api_payment');
Can you provide your config?
AppKernel.php
$bundles = [
new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
new Symfony\Bundle\SecurityBundle\SecurityBundle(),
new Symfony\Bundle\TwigBundle\TwigBundle(),
new Symfony\Bundle\MonologBundle\MonologBundle(),
new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(),
new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
new EightPoints\Bundle\GuzzleBundle\GuzzleBundle(),
new AppBundle\AppBundle(),
];
app/config/config.yml
guzzle:
clients:
telegram_bot:
base_url: "https://api.telegram.org/bot%bot_api_key%/"
headers:
Accept: "application/json"
DefaultController.php
/**
* @Route("/webhook/{token}")
*/
public function webhookAction(Request $request, $token = null)
{
$client = $this->get('guzzle.client.telegram_bot');
$response = $client->get('/getMe');
return new Response("Hey! " . $token . "<br />" . $response);
}
In your config your client is called "telegram_bot". In your service you name it "*group". You should change that to:
$this->get('guzzle.client.telegram_bot');
Still, missing service :confused: Appears to be an IDE error rather than a Symfony error.....
Ok. But anyway, we should update the README to make it more clear to use the same name of client in service call. Will do that later.
Having followed the readme, and having put the neccesary info in app/config/config.yml by the instructions, i'm getting a "missing service" when trying to use $this->get()
The instructions are very unclear and could use a more in depth explanation and a step by step guide on how to use this bundle....