{"id":15027270,"url":"https://github.com/commandstring/phpcord","last_synced_at":"2025-07-20T08:36:40.486Z","repository":{"id":192944562,"uuid":"687769830","full_name":"CommandString/PHPCord","owner":"CommandString","description":"A modern discord api wrapper in PHP","archived":true,"fork":false,"pushed_at":"2023-11-26T21:19:52.000Z","size":176,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-13T03:15:46.330Z","etag":null,"topics":["composer","discord","discord-api","discord-api-wrapper","php","php8","php81","php82"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/CommandString.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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":"2023-09-06T01:09:37.000Z","updated_at":"2025-02-18T01:07:32.000Z","dependencies_parsed_at":"2023-09-06T03:31:28.410Z","dependency_job_id":"8801add5-be78-482d-b730-6ac08d6fb93d","html_url":"https://github.com/CommandString/PHPCord","commit_stats":null,"previous_names":["commandstring/phpcord"],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CommandString%2FPHPCord","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CommandString%2FPHPCord/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CommandString%2FPHPCord/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CommandString%2FPHPCord/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CommandString","download_url":"https://codeload.github.com/CommandString/PHPCord/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243330319,"owners_count":20274039,"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":["composer","discord","discord-api","discord-api-wrapper","php","php8","php81","php82"],"created_at":"2024-09-24T20:06:05.914Z","updated_at":"2025-03-13T03:15:51.217Z","avatar_url":"https://github.com/CommandString.png","language":"PHP","readme":"# PHPCord\n\nA modern Discord API wrapper for PHP\n\n**NOTE**: This is still in development and is not ready for production use\n\n## Requirements\n\n- PHP 8.1+\n- Composer\n\n## Resources\n\n- [Discord Developer Portal](https://discord.com/developers/docs/intro)\n\n## Installation\n\n```bash\ncomposer require phpcord/phpcord\n```\n\n## Example\n\n```php\n\u003c?php\n\nuse PHPCord\\PHPCord\\Builders\\MessageBuilder;\nuse PHPCord\\PHPCord\\Discord;\nuse Discord\\Http\\Drivers\\Guzzle;\nuse Monolog\\Handler\\StreamHandler;\nuse Monolog\\Logger;\nuse PHPCord\\PHPCord\\Gateway\\Event;\nuse PHPCord\\PHPCord\\Gateway\\Events\\Ready;\nuse PHPCord\\PHPCord\\Parts\\Commands\\ApplicationCommand;\nuse PHPCord\\PHPCord\\Parts\\Commands\\ApplicationCommandOption;\nuse PHPCord\\PHPCord\\Parts\\Commands\\ApplicationCommandOptionChoice;\nuse PHPCord\\PHPCord\\Parts\\Commands\\ApplicationCommandOptionType;\nuse PHPCord\\PHPCord\\Parts\\Interactions\\Interaction;\nuse PHPCord\\PHPCord\\Parts\\Interactions\\InteractionResponse;\nuse PHPCord\\PHPCord\\Parts\\Interactions\\InteractionResponseType;\nuse PHPCord\\PHPCord\\Parts\\Interactions\\InteractionType;\nuse PHPCord\\PHPCord\\Parts\\Messages\\MessageFlag;\nuse function React\\Async\\await;\n\nrequire_once __DIR__ . '/vendor/autoload.php';\n\n// ignore the fact I made this a constant. 😵‍💫\nconst LOGGER = new Logger('PHPCord', [new StreamHandler('php://stdout')]);\n\n$bot = (new Discord(\n    TOKEN,\n    LOGGER\n))-\u003ewithRest(\n    new Guzzle(options: ['verify' =\u003e false])\n)-\u003ewithGateway();\n\ndefine('START_TIME', time());\n\n$bot-\u003egateway-\u003eonEvent(Event::READY, static function (Ready $ready) use ($bot) {\n    LOGGER-\u003einfo(\"{$ready-\u003euser-\u003eusername} is ready!\");\n\n    return; // remove to register command\n\n    $command = new ApplicationCommand();\n    $command-\u003ename = 'status';\n    $command-\u003edescription = 'Get the status of the bot';\n\n    $typeOption = new ApplicationCommandOption();\n    $typeOption-\u003ename = 'type';\n    $typeOption-\u003edescription = 'The type of status';\n    $typeOption-\u003etype = ApplicationCommandOptionType::STRING;\n    $typeOption-\u003erequired = true;\n\n    $typeOptionRam = new ApplicationCommandOptionChoice();\n    $typeOptionRam-\u003ename = $typeOptionRam-\u003evalue = 'ram';\n\n    $typeOptionUptime = new ApplicationCommandOptionChoice();\n    $typeOptionUptime-\u003ename = $typeOptionUptime-\u003evalue = 'uptime';\n\n    $typeOption-\u003echoices = [$typeOptionRam, $typeOptionUptime];\n    $command-\u003eoptions = [$typeOption];\n\n    await($bot-\u003erest-\u003eguildCommands-\u003ecreateCommand($ready-\u003eapplication-\u003eid, '988910112825548811', $command));\n\n    LOGGER-\u003einfo('Created status command!');\n});\n\n$bot-\u003egateway-\u003eonEvent(Event::INTERACTION_CREATE, static function (Interaction $interaction) use ($bot) {\n    if (\n        $interaction-\u003etype !== InteractionType::APPLICATION_COMMAND ||\n        $interaction-\u003edata-\u003ename !== 'status'\n    ) {\n        return;\n    }\n\n    $type = $interaction-\u003edata-\u003eoptions[0]-\u003evalue;\n\n    if ($type === 'ram') {\n        $messageContent = 'RAM Usage is ' . round(memory_get_usage() / 1024 / 1024, 2) . 'MB';\n    } else if ($type === 'uptime') {\n        $messageContent = 'The bot was started \u003ct:' . START_TIME . ':R\u003e';\n    }\n\n    $response = new InteractionResponse();\n    $response-\u003etype = InteractionResponseType::CHANNEL_MESSAGE_WITH_SOURCE;\n    $response-\u003edata = (new MessageBuilder())\n        -\u003ewithContent($messageContent)\n        -\u003ewithFlags(MessageFlag::EPHEMERAL)\n        -\u003ebuild();\n\n    $bot-\u003erest-\u003einteractions-\u003ecreateResponse(\n        $interaction-\u003eid,\n        $interaction-\u003etoken,\n        $response\n    );\n});\n\n$bot-\u003egateway-\u003estart();\n```\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcommandstring%2Fphpcord","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcommandstring%2Fphpcord","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcommandstring%2Fphpcord/lists"}