PHPackages                             kaspars/hunter - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. kaspars/hunter

ActiveLibrary[API Development](/categories/api)

kaspars/hunter
==============

Hunter is an easy to use uHunt wrapper to receive information from UVA servers.

1.2.1(10y ago)9711MITPHPPHP &gt;=5.3.0

Since Apr 19Pushed 9y ago4 watchersCompare

[ Source](https://github.com/kasparsklavins/Hunter)[ Packagist](https://packagist.org/packages/kaspars/hunter)[ Docs](https://github.com/kasparsklavins/Hunter)[ RSS](/packages/kaspars-hunter/feed)WikiDiscussions master Synced today

READMEChangelog (4)DependenciesVersions (5)Used By (0)

[![Build Status](https://camo.githubusercontent.com/08bf4f371a68206ed633956ae576a4fd2382de2d87531d7e7d5a2099ec379998/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6b6173706172736b6c6176696e732f48756e7465722f6261646765732f6275696c642e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/kasparsklavins/Hunter/build-status/master)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/542c288b03b478ef8d9bc5d46de278c0cf69d48be8ab07c6598b428f85574b71/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6b6173706172736b6c6176696e732f48756e7465722f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/kasparsklavins/Hunter/?branch=master)[![Code Coverage](https://camo.githubusercontent.com/f96faf727e6fcbf88118a92fa7b798a9d9cd5481350988c9032c1c4aa8ba9eff/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6b6173706172736b6c6176696e732f48756e7465722f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/kasparsklavins/Hunter/?branch=master)

Introduction
============

[](#introduction)

Hunter is an easy to use [uHunt](http://uhunt.felix-halim.net/api) wrapper to receive information from [UVa's online judge](http://uva.onlinejudge.org/).

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

Basic Usage
===========

[](#basic-usage)

```
use Hunter\Hunter;

require "vendor/autoload.php";

$hunter = new Hunter();

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

Installing
==========

[](#installing)

With Composer
-------------

[](#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
---------------

[](#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
===========

[](#data-format)

All data is returned as an associated array.

Problem format
--------------

[](#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
-----------------

[](#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
---------------

[](#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
```

Examples
========

[](#examples)

problems(void)
--------------

[](#problemsvoid)

Returns an array of available UVa problems

```
$hunter = new Hunter\Hunter();
var_dump($hunter->problems());
```

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

[](#problemint-id-string-type--id)

Retrieved data of a specific problem

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

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

[](#problemsubmissionsarrayint-problemids-int-start--0-int-end--231)

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

```
$hunter = new Hunter\Hunter();
var_dump($hunter->problemSubmissions(36));
var_dump($hunter->problemSubmissions(array(36,37)));
```

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

[](#problemranklistint-problemid-int-rank--1-int-count--100)

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

```
$hunter = new Hunter\Hunter();
var_dump($hunter->problemRanklist(36));
```

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

[](#userproblemranklistint-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)
---------------------------------------------

[](#usersubmissionsint-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();
var_dump($hunter->userSubmissions(343417));
```

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

[](#userlatestsubmissionsint-userid-int-count--10)

Returns the last $count submissions of a particular user.

```
$hunter = new Hunter\Hunter();
var_dump($hunter->userLatestSubmissions(343417));
```

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

[](#userproblemsubmissionsarrayint-userids-arrayint-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)
--------------------------------------

[](#usersolvedproblemsarrayint-userids)

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

```
$hunter = new Hunter\Hunter();
var_dump($hunter->userSolvedProblems(343417));
```

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

[](#userranklistint-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)
----------------------------------------

[](#ranklistint-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)
-------------------------

[](#setsourcestring-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();
var_dump($hunter->setSource('http://icpcarchive.ecs.baylor.edu/uhunt/api/'));
```

getSource()
-----------

[](#getsource)

Returns the current used API source.

```
$hunter = new Hunter\Hunter();
var_dump($hunter->getSource());
```

###  Health Score

30

—

LowBetter than 62% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity61

Established project with proven stability

 Bus Factor1

Top contributor holds 88.2% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~49 days

Total

4

Last Release

3946d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/68d9a0a932a473f19e1db4a2225f11e079105f9a7d21c31079f71fc7f5f7de19?d=identicon)[kasparsklavins](/maintainers/kasparsklavins)

---

Top Contributors

[![kasparsklavins](https://avatars.githubusercontent.com/u/4699174?v=4)](https://github.com/kasparsklavins "kasparsklavins (15 commits)")[![MaSteve](https://avatars.githubusercontent.com/u/8020138?v=4)](https://github.com/MaSteve "MaSteve (1 commits)")[![scrutinizer-auto-fixer](https://avatars.githubusercontent.com/u/6253494?v=4)](https://github.com/scrutinizer-auto-fixer "scrutinizer-auto-fixer (1 commits)")

---

Tags

competitive-programmingphpuhuntuvaonline judgeuvauhuntcompetitive programming

### Embed Badge

![Health badge](/badges/kaspars-hunter/health.svg)

```
[![Health](https://phpackages.com/badges/kaspars-hunter/health.svg)](https://phpackages.com/packages/kaspars-hunter)
```

###  Alternatives

[exsyst/swagger

A php library to manipulate Swagger specifications

35916.4M7](/packages/exsyst-swagger)[hubspot/api-client

Hubspot API client

24016.2M20](/packages/hubspot-api-client)[pocketmine/bedrock-protocol

An implementation of the Minecraft: Bedrock Edition protocol in PHP

172445.0k15](/packages/pocketmine-bedrock-protocol)[botman/driver-telegram

Telegram driver for BotMan

93459.5k6](/packages/botman-driver-telegram)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
