Build Discord bots with modern PHP.
Documentation · Quick start · Discord
Tempcord is an open-source framework for building Discord bots with PHP 8.5+, powered by Tempest. Define commands, events, and interactive components as typed PHP classes; Tempcord discovers them and handles their Discord registration and routing.
- PHP-native interactions — slash commands, options, events, buttons, select menus, modals, and autocomplete are declared with PHP attributes.
- Typed by default — PHP parameter types drive Discord option types and give your IDE useful information.
- Built on Tempest — use dependency injection and the same discovery model across commands, listeners, and plugins.
- Gateway-aware — read cached guilds, channels, roles, members, and voice states without turning every lookup into a REST request.
- Extensible — add reusable plugins, scheduled tasks, or an HTTP server that shares the bot's container and event loop.
Create a bot project and run the interactive setup:
composer create-project tempcord/tempcord my-bot
cd my-bot
php tempcord initThe setup wizard stores and verifies your bot token, provides an invite link, and can register the starter commands for you.
When commands change, register them as the bot starts:
php tempcord boot --registerFor normal starts, registration is not required:
php tempcord boot<?php
namespace App\Commands;
use Tempcord\Attributes\Command;
use Tempcord\Discord\Interaction\CommandInteraction;
#[Command(description: 'Ping? Pong!')]
final readonly class PingCommand
{
public function __invoke(CommandInteraction $interaction): void
{
$interaction->reply('Pong!');
}
}The class name becomes /ping. Add typed parameters with #[Option], or use the same attribute-first model for events and interactive components.
| Repository | Purpose |
|---|---|
tempcord |
Starter project and the recommended way to create a new bot |
framework |
Core framework, runtime, and source-generated documentation |
discord-php |
Async Discord REST API and gateway wrapper used by the framework |
tasks |
Scheduled tasks discovered and resolved like other Tempcord handlers |
http |
HTTP routes running inside the bot on its event loop |
- Read the getting-started guide and framework reference.
- Report framework bugs or propose features in the framework issue tracker.
- See the contribution guide before opening a pull request.
- Join the Tempcord Discord community.
Tempcord is under active development. Its packages are released under the MIT License.
