Disboard provides a global helper class (app/Http/Helpers.php) that can be accessed from anywhere in the application without requiring any specific class includes. This class contains utility functions ranging from calling the Discord API directly to simply getting a user's avatar. This class is internally used by the provided Disboard models for retrieving aggregate data as well.

Available functions

By default, Disboard comes with the following default helper functions:


Discord API (dapi)


Returns the current git commit hash for the master branch.

$short (default: false) - Return a shortened version of the hash (7 characters)


Returns getCurrentGitCommit(true) along with the date/time of the commit. This is currently being used to show the current application version in the footer.

dapi($url, $method, $asUser, $user, $opts)

Calls the Discord API with the provided information. Returns the result of the API call.

$url - The Discord API endpoint to call (ex: 'users/@me/guilds').
$method (default: 'get') - The http method to use. Only 'get', 'post', 'patch', and 'delete' are currently implemented.
$asUser (default: false) - Whether or not to call the API as a user. If true, the $user parameter must be set to a valid user.
$user (default: null) - The user to call the API as. Ignored if $asUser is false.
$opts (default: array()) - Additional http options to add to the API call.

This function should only be used as a fallback if other helper functions/model attributes don't already exist!

dapi_getUserAvatar($userid, $discrim)

Gets the specified user's avatar, or returns a default one if it doesn't exist.

$userid - The Discord User ID to get the avatar for.
$discrim (default: '0001') - The user's discriminator. Used for retrieving the default Discord avatar for this user.

This function will return a gif if the user has an animated avatar, or a png if not.

You should call the avatar attribute on the user object instead of calling this function directly!


Returns a list of the specified user's guilds.

$user - The user instance to get the guilds from.

You should call the guilds attribute on the user object instead of calling this function directly!


Returns a Discord guild object based on the id provided.

$id - The guild's Discord ID.

It's recommended to instead call the Guild::fromId($id) static function in the Guild model.