Skip to content


Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time

Build Status Scrutinizer Code Quality Code Coverage


Hunter is an easy to use uHunt wrapper to receive information from UVa's online judge.

Hunter is licensed under the MIT License - see the LICENSE file for details.

Basic Usage

use Hunter\Hunter;

require "vendor/autoload.php";

$hunter = new Hunter();

echo $hunter->getIdFromUsername("Kaspars");


With Composer

The easiest and recommended method to install Hunter is via composer.

Use the following command to install with composer.

$ composer require kaspars/hunter

If you wish you can create the following composer.json file and run composer install to install it.

   "require": {
      "kaspars/hunter": "~1.0"

Direct Download

First of all, you really should use composer.. But if you insist, then just copy the content from src folder into your project

Data Format

All data is returned as an associated array.

Problem format

  • id Problem ID
  • number Problem number
  • title Problem title
  • dacu Number of distinct accepted users
  • bestRuntime Best runtime in milliseconds of an Accepted Submission
  • verdicts An array given verdicts
    • Hunter\Status::NO_VERDICT Number of No Verdict Given (can be ignored)
    • Hunter\Status::SUBMISSION_ERROR Number of Submission Error
    • Hunter\Status::CANT_BE_JUDGED Number of Can't be Judged
    • Hunter\Status::IN_QUEUE Number of In Queue
    • Hunter\Status::COMPILATION_ERROR Number of Compilation Error
    • Hunter\Status::RESTRICTED_FUNCTION Number of Restricted Function
    • Hunter\Status::RUNTIME_ERROR Number of Runtime Error
    • Hunter\Status::OUTPUT_LIMIT Number of Output Limit Exceeded
    • Hunter\Status::TIME_LIMIT Number of Time Limit Exceeded
    • Hunter\Status::MEMORY_LIMIT Number of Memory Limit Exceeded
    • Hunter\Status::WRONG_ANSWER Number of Wrong Answer
    • Hunter\Status::PRESENTATION_ERROR Number of Presentation Error
    • Hunter\Status::ACCEPTED Number of Accepted
  • limit Problem runtime limit in milliseconds
  • status Problem Status
    • Hunter\Status::UNAVAILABLE Unavailable
    • Hunter\Status::Normal Normal
    • Hunter\Status::SPECIAL_JUDGE A special judging program is used.
  • rejudged Last time (unix timestamp) the problem was rejudged, null if never.

Submission format

  • id Submission`s ID
  • user User ID
  • name User's full name
  • username User`s username
  • problem Problem's ID
  • verdict Given verdict
    • Hunter\Status::SUBMISSION_ERROR Submission Error
    • Hunter\Status::CANT_BE_JUDGED Can't be Judged
    • Hunter\Status::IN_QUEUE In Queue
    • Hunter\Status::COMPILATION_ERROR Compilation Error
    • Hunter\Status::RESTRICTED_FUNCTION Restricted Function
    • Hunter\Status::RUNTIME_ERROR Runtime Error
    • Hunter\Status::OUTPUT_LIMIT Output Limit Exceeded
    • Hunter\Status::TIME_LIMIT Time Limit Exceeded
    • Hunter\Status::MEMORY_LIMIT Memory Limit Exceeded
    • Hunter\Status::WRONG_ANSWER Wrong Answer
    • Hunter\Status::PRESENTATION_ERROR Presentation Error
    • Hunter\Status::ACCEPTED Accepted
  • language Language in which submission was written
    • Hunter\Language::ANSI_C Ansi C
    • Hunter\Language::Java Java
    • Hunter\Language::CPLUSPLUS C++
    • Hunter\Language::PASCAL Pascal
    • Hunter\Language::CPLUSPLUS11 C++11
    • Hunter\Language::PYTHON Python
  • runtime Runtime in milliseconds
  • rank Submission rank, compared to all
  • time Submission unix timestamp

Ranklist format

  • id User`s ID
  • name User`s name
  • username User`s username
  • rank User's rank
  • accepted The number of accepted problems
  • submissions The number of submissions
  • activity Array of user's activity
    • Hunter\Activity::DAYS Activity in the last 2 days
    • Hunter\Activity::WEEK Activity in the last 7 days
    • Hunter\Activity::MONTH Activity in the last 31 days
    • Hunter\Activity::QUARTER Activity in the last 3 months
    • Hunter\Activity::YEAR Activity in the last year

#API ##getIdFromUsername(string $username) Convert the given $username to a UVa ID.

Returns either the id, or null if not found

$hunter = new Hunter\Hunter();
echo $hunter->getIdFromUsername("Kaspars"); //343417
echo $hunter->getIdFromUsername("Foobar"); // null



Returns an array of available UVa problems

$hunter = new Hunter\Hunter();

problem(int $id, string $type = "id")

Retrieved data of a specific problem

$hunter = new Hunter\Hunter();
var_dump($hunter->problem(100, "num"));

problemSubmissions(array|int $problemIDS, int $start = 0, int $end = 2^31)

View submissions to specific problems on a given submission date range. $start and $end are unix timestamps

$hunter = new Hunter\Hunter();

problemRanklist(int $problemID, int $rank = 1, int $count = 100)

Returns submissions to a problem ranked from $rank to $rank + $count - 1.

$hunter = new Hunter\Hunter();

userProblemRanklist(int $problemID, int $userID, int $above = 10, int $below = 10)

Returns nearby submissions (by runtime) for a particular user submission to a problem.

$hunter = new Hunter\Hunter();
var_dump($hunter->userProblemRanklist(36, 343417));

userSubmissions(int $userID, int $min = null)

Returns all of the submissions of a particular user.

if $min is specified, only submissions with ID larger than $min will be returned.

$hunter = new Hunter\Hunter();

userLatestSubmissions(int $userID, int $count = 10)

Returns the last $count submissions of a particular user.

$hunter = new Hunter\Hunter();

userProblemSubmissions(array|int $userIDs, array|int $problemIDs, int $min, string $type = "id")

Returns all the submissions of the users on specific problems.

Possible $type values are id and num. This changes whether you pass problem id's or problem num's as the second argument.

$hunter = new Hunter\Hunter();
var_dump($hunter->userProblemSubmissions(343417, 36);

userSolvedProblems(array|int $userIDs)

Get The Bit-Encoded-Problem IDs that Has Been Solved by Some Authors.

$hunter = new Hunter\Hunter();

userRanklist(int $userID, int $above = 10, int $below = 10)

Returns the user's ranklist and their closest neighbors.

$hunter = new Hunter\Hunter();
var_dump($hunter->userRanklist(343417, 10, 10));

ranklist(int $rank = 1, int $count = 10)

Global ranklist, starteing from $rank to $rank+$count

$hunter = new Hunter\Hunter();
var_dump($hunter->ranklist(1, 100));

setSource(string $source)

Change the source of API data. The default is, another valid source is But you can switch to any source that has the same data format.

$hunter = new Hunter\Hunter();


Returns the current used API source.

$hunter = new Hunter\Hunter();


An easy to use uHunt wrapper to receive information from UVa online judge.








No packages published