use EvolutionApiPlugin\EvolutionApi;
class ExampleController extends Controller
{
protected $evolutionApi;
public function __construct(EvolutionApi $evolutionApi)
{
$this->evolutionApi = $evolutionApi;
}
public function sendMessage()
{
$response = $this->evolutionApi->sendTextMessage(
'5511999999999', // Número
'Olá, mundo!' // Texto da mensagem
);
return response()->json($response);
}
}
use EvolutionApiPlugin\EvolutionApi;
$apiKey = 'SUA_CHAVE_AQUI';
## Evolution API Plugin
Biblioteca PHP para integrar aplicações (Laravel ou PHP puro) com a API Evolution.
Este README fornece:
- Instruções de instalação e configuração
- Exemplos completos de uso (Laravel e PHP puro)
- Referência detalhada da API pública da biblioteca (métodos, parâmetros, estruturas)
- Troubleshooting e FAQ
## Requisitos
- PHP >= 8.1
- Extensão cURL (usada pelo Guzzle)
- dependência: guzzlehttp/guzzle (já indicada no composer.json)
## Instalação
Instale via Composer:
use EvolutionApiPlugin\EvolutionApi;
$apiKey = 'SUA_CHAVE_AQUI';
$apiUrl = 'https://seu-evolution.example.com';
$evolution = new EvolutionApi($apiKey, $apiUrl);
$response = $evolution->sendTextMessage('exampleInstance', '5511999999999', 'Olá do Evolution!');
print_r($response);
use EvolutionApiPlugin\EvolutionApi;
class EvolutionController extends Controller
{
public function send(EvolutionApi $evolution)
{
$resp = $evolution->sendTextMessage('meuInstance', '5511999999999', 'Olá do Laravel');
return response()->json($resp);
}
}
bash
php artisan vendor:publish --tag=config
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.