labymod / discord-webhook-bundle
Discord Webhook Bundle, based on labymod/discord-webhook
Installs: 1 225
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 2
Forks: 1
Open Issues: 3
Type:symfony-bundle
Requires
- php: ^8.0
- labymod/discord-webhook: ^2.0 || ^3.0
- symfony/framework-bundle: ^4.4 || ^5.0 || ^6.0
- symfony/string: ^5.0 || ^6.0
Requires (Dev)
- roave/security-advisories: dev-latest
This package is auto-updated.
Last update: 2024-11-04 16:48:13 UTC
README
Symfony Bundle for labymod/discord-webhook. Configure webhooks easily within your Symfony application
Versions & Compatibility
Installation
Composer installation
composer require labymod/discord-webhook-bundle
Symfony configuration & usage
- Enable your bundle in
config/bundles.php
:return [ // ... \DiscordWebhookBundle\DiscordWebhookBundle::class => ['all' => true], ]
- Add a global and/or environment-based configuration file:
config/[env]/discord_webhook.yaml
Configuration reference
# Default configuration discord_webhook: default_url: ~ # required, The Webhook URL for the default service. clients: # Prototype name: # choose a name (service-id) for your preconfigured client webhook_url: ~ # required, The Discord Webhook URL for this client. username: null # optional, The username for the Discord bot. avatar_url: null # optional, URL which is used for the Bot avatar.
Usage
Default Client
With discord_webhook.default_url
configured, the basic service (DiscordWebhookBundle\DiscordWebhook
) is configured and publicly available in the service container:
Additional named clients
If you have configured one or more named clients like below, you can access them in two ways by their name.
discord_webhook # ... clients: announcements.client: webhook_url: 'https://discord.com/my/webhook/url'
Now this client is available as service too:
use DiscordWebhookBundle\DiscordWebhook; class MyController { public function myAction(DiscordWebhook $announcementsClient) // <-- Thanks to an ArgumentValueResolver, name the parameter after your client, and it will be resolved automatically { // OR, resolve it from the container: $webhook = $this->container->get('announcements.client'); } }
Documentation
For detailed documentation how to use the Webhooks, please refer to the underlying library:
https://github.com/LabyMod/discord-webhook/blob/master/README.md
For further documentation have a look here: