{"id":18447334,"url":"https://github.com/kerogs/discord-webhooks-php","last_synced_at":"2026-02-03T17:09:18.338Z","repository":{"id":233631635,"uuid":"787565365","full_name":"kerogs/Discord-webhooks-php","owner":"kerogs","description":"Simple PHP function for sending discord webhooks","archived":false,"fork":false,"pushed_at":"2024-05-15T11:46:31.000Z","size":7,"stargazers_count":5,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-23T03:32:19.964Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kerogs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-04-16T19:05:52.000Z","updated_at":"2025-01-20T15:43:44.000Z","dependencies_parsed_at":"2024-04-17T00:38:24.892Z","dependency_job_id":"06e0a0a8-b73d-4482-8813-835be230cb27","html_url":"https://github.com/kerogs/Discord-webhooks-php","commit_stats":null,"previous_names":["kerogs/discord-webhooks-php"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kerogs%2FDiscord-webhooks-php","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kerogs%2FDiscord-webhooks-php/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kerogs%2FDiscord-webhooks-php/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kerogs%2FDiscord-webhooks-php/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kerogs","download_url":"https://codeload.github.com/kerogs/Discord-webhooks-php/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247755439,"owners_count":20990617,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-06T07:12:47.701Z","updated_at":"2026-02-03T17:09:16.581Z","avatar_url":"https://github.com/kerogs.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Discord Webhooks PHP\n\nA simple PHP library for sending messages to Discord via webhooks, supporting both plain text and rich embed messages.\n\n## Features\n\n- Send plain text messages to Discord channels\n- Send rich embed messages with customizable fields, colors, and media\n- Easy integration using cURL\n- Customizable webhook appearance (username, avatar)\n\n## Requirements\n\n- PHP 5.4 or higher\n- cURL extension enabled\n\n## Installation\n\nClone or download the repository:\n\n```bash\ngit clone https://github.com/yourusername/discord-webhooks-php.git\ncd discord-webhooks-php\n```\n\nInclude the appropriate PHP file in your project or use the provided templates.\n\n## Usage\n\n### Setting up the Webhook URL\n\n1. Go to your Discord server settings\n2. Navigate to **Integrations** \u003e **Webhooks**\n3. Create a new webhook or select an existing one\n4. Copy the webhook URL\n\nSet the `$webhook_url` variable in your script to this URL, or use the environment variable `DISCORD_WEBHOOK_URL`.\n\n### Sending a Simple Message\n\nUse `simple-message.php` as a starting point for plain text messages.\n\n```php\n\u003c?php\n\n$webhook_url = getenv('DISCORD_WEBHOOK_URL') ?: 'YOUR_WEBHOOK_URL_HERE';\n\n$msg = [\n    \"username\" =\u003e \"My Bot\",\n    \"content\" =\u003e \"Hello, this is a simple message!\",\n    \"avatar_url\" =\u003e \"https://example.com/avatar.png\"\n];\n\n$headers = ['Content-Type: application/json'];\n\n$ch = curl_init();\ncurl_setopt($ch, CURLOPT_URL, $webhook_url);\ncurl_setopt($ch, CURLOPT_POST, true);\ncurl_setopt($ch, CURLOPT_HTTPHEADER, $headers);\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\ncurl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);\ncurl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($msg));\n$response = curl_exec($ch);\ncurl_close($ch);\n\necho $response;\n```\n\n### Sending an Embed Message\n\nUse `embed-message.php` as a template for rich embed messages.\n\n```php\n\u003c?php\n\n$webhook_url = getenv('DISCORD_WEBHOOK_URL') ?: 'YOUR_WEBHOOK_URL_HERE';\n\n$msg = [\n    \"username\" =\u003e \"My Bot\",\n    \"embeds\" =\u003e [\n        [\n            \"color\" =\u003e 0xb7996d, // color in hexadecimal\n            \"title\" =\u003e \"Embed Title\",\n            \"url\" =\u003e \"https://example.com\",\n            \"description\" =\u003e \"This is a rich embed message.\",\n            \"timestamp\" =\u003e date('c'), // Current timestamp\n            \"author\" =\u003e [\n                \"name\" =\u003e \"Author Name\",\n                \"url\" =\u003e \"https://example.com/author\",\n                \"icon_url\" =\u003e \"https://example.com/author-icon.png\"\n            ],\n            \"fields\" =\u003e [\n                [\n                    \"name\" =\u003e \"Field 1\",\n                    \"value\" =\u003e \"Value 1\",\n                    \"inline\" =\u003e true\n                ],\n                [\n                    \"name\" =\u003e \"Field 2\",\n                    \"value\" =\u003e \"Value 2\",\n                    \"inline\" =\u003e true\n                ]\n            ],\n            \"footer\" =\u003e [\n                \"text\" =\u003e \"Footer text\",\n                \"icon_url\" =\u003e \"https://example.com/footer-icon.png\"\n            ],\n            \"image\" =\u003e [\n                \"url\" =\u003e \"https://example.com/image.png\"\n            ],\n            \"thumbnail\" =\u003e [\n                \"url\" =\u003e \"https://example.com/thumbnail.png\"\n            ]\n        ]\n    ]\n];\n\n// Same cURL code as above...\n```\n\n## Message Structure Reference\n\n### Base Properties\n\n| Property    | Type   | Description |\n|-------------|--------|-------------|\n| `username`  | string | The name displayed for the webhook |\n| `avatar_url`| string | URL for the webhook's avatar image |\n| `content`   | string | Plain text content (for simple messages) |\n\n### Embed Properties\n\n| Property    | Type   | Description |\n|-------------|--------|-------------|\n| `color`     | int    | Color of the embed sidebar (decimal value) |\n| `title`     | string | Title of the embed |\n| `url`       | string | URL linked to the title |\n| `description`| string| Main text content of the embed |\n| `timestamp` | string | ISO 8601 timestamp |\n\n#### Author Object\n| Property    | Type   | Description |\n|-------------|--------|-------------|\n| `name`      | string | Author name |\n| `url`       | string | URL linked to the author name |\n| `icon_url`  | string | Author icon URL |\n\n#### Fields Array\n| Property    | Type   | Description |\n|-------------|--------|-------------|\n| `name`      | string | Field name |\n| `value`     | string | Field value |\n| `inline`    | bool   | Whether the field is inline |\n\n#### Footer Object\n| Property    | Type   | Description |\n|-------------|--------|-------------|\n| `text`      | string | Footer text |\n| `icon_url`  | string | Footer icon URL |\n\n#### Image Object\n| Property    | Type   | Description |\n|-------------|--------|-------------|\n| `url`       | string | Large image URL |\n\n#### Thumbnail Object\n| Property    | Type   | Description |\n|-------------|--------|-------------|\n| `url`       | string | Small thumbnail image URL |\n\n## Examples\n\nThe `example/` directory contains additional examples:\n\n- `spotify.php`: Example of a Spotify track embed\n- `twitch.php`: Example of a Twitch stream embed\n- `empty.php`: Minimal template\n\n## API Documentation\n\nFor complete Discord webhook API documentation, refer to the [official Discord Developer Portal](https://discord.com/developers/docs/resources/webhook).\n\n## Contributing\n\nContributions are welcome! Please feel free to submit issues and pull requests.\n\n## License\n\nThis project is open source. Check the LICENSE file for details.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkerogs%2Fdiscord-webhooks-php","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkerogs%2Fdiscord-webhooks-php","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkerogs%2Fdiscord-webhooks-php/lists"}