zeggriim / yousign-webhook-bundle
A Symfony bridge for handling Yousign webhooks via RemoteEvent.
Requires
- php: >=8.2
- symfony/framework-bundle: ^5.4|^6.0|^7.0
- symfony/http-foundation: ^6.0|^7.0
- symfony/http-kernel: ^6.0|^7.0
- symfony/remote-event: ^6.0|^7.0
- webmozart/assert: ^1.11
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.82
- phpstan/phpstan: ^2.1
- phpunit/phpunit: ^12.2
README
Un bridge Symfony permettant de recevoir les événements Webhook de Yousign via le composant RemoteEvent
.
📦 Installation
Ajoutez ce bundle à votre projet Symfony via Composer :
composer require zeggriim/yousign-webhook-bundle
⚙️ Activer le bundle
Symfony Flex activera automatiquement le bundle si vous l’avez installé comme un package distant. Sinon, ajoutez-le manuellement dans config/bundles.php :
return [ Zeggriim\YousignWebhookBundle\YousignWebhookBundle::class => ['all' => true], ];
🔀 Configuration des routes
Ajouter la cléf secret fourni par Yousign dans l'admin :
# config/packages/yousign_webhook.yaml yousign_webhook: secret: "%env(SECRET_YOUSIGN)%"
Importez les routes exposées par le bundle dans votre fichier config/routes/yousign_webhook.yaml :
# config/yousign_webhook.yaml yousign_webhook: resource: '@YousignWebhookBundle/Resources/config/routes.yaml'
Cela exposera un endpoint (par défaut) POST accessible sur :
/webhook/yousign
Vous pouvez surcharger ce chemin en définissant un paramètre :
# config/packages/yousign_webhook.yaml parameters: yousign.webhook.endpoint: /votre/endpoint/personnalisé
Exemple cas d'utilisation
Une fois terminé, ajoutez un consumer avec le RemoteEvent en utilisant le name 'yousign'. Cela te permettra de réagir avec le webhook entrants.
use Symfony\Component\RemoteEvent\Attribute\AsRemoteEventConsumer; use Symfony\Component\RemoteEvent\Consumer\ConsumerInterface; use Symfony\Component\RemoteEvent\RemoteEvent; #[AsRemoteEventConsumer('yousign')] final class YousignWebhookConsumer implements ConsumerInterface { public function consume(RemoteEvent $event): void { // Implement your own logic here } }