PHPackages                             timutech/codecombat-api - 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. timutech/codecombat-api

ActiveLibrary[API Development](/categories/api)

timutech/codecombat-api
=======================

Package for codecombat.com REST API

v0.5.2(8y ago)32111MITPHPPHP ^7.1.1

Since Apr 16Pushed 8y ago1 watchersCompare

[ Source](https://github.com/TimuTech/codecombat-api)[ Packagist](https://packagist.org/packages/timutech/codecombat-api)[ RSS](/packages/timutech-codecombat-api/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependencies (2)Versions (22)Used By (0)

codecombat-api
==============

[](#codecombat-api)

### PHP package for CodeCombat REST API

[](#php-package-for-codecombat-rest-api)

**codecombat-api** is a package for the [CodeCombat](https://codecombat.com/api-docs) REST API. It provides an abstracted interface to talk with the CodeCombat API. The Package contains a Laravel ServiceProvider to inject it into the Laravel Service Container, but other than that the package is framework-agnostic. Please look at the [CodeCombat API Documentation](https://codecombat.com/api-docs) for more details and do not be afraid to peruse the source code on this package.

Installation
------------

[](#installation)

`composer require timutech/codecombat-api`

Configuration
-------------

[](#configuration)

You will preferably need to have your own OAuth2 server. You will need to have a lookup URL where CodeCombat can query an AccessToken you give them and then you will return the User on your system linked to that AccessToken. eg `https://yoursite.com/api/auth/{token}` which returns a User with a **required** `id` field.

### Normal

[](#normal)

Make sure you keep your CodeCombat OAuth `{CLIENT_ID}`, `{CLIENT_SECRET}` and `{OAUTH_PROVIDER_ID}` in whatever config you have as you will need it to instantiate an instance.

### Laravel

[](#laravel)

Add the line `TimuTech\CodeCombat\CodeCombatserviceProvider::class,` like below in your `config/app.php` file.

```
'providers' => [
	// Other

	TimuTech\CodeCombat\CodeCombatServiceProvider::class,
],
```

Add your CodeCombat OAuth credentials to your `config/services.php` file, as below.

```
// Other services

'codecombat' => [
    'id' => '{CLIENT_ID}',
    'secret' => '{CLIENT_SECRET}',
    'provider_id' => '{OAUTH_PROVIDER_ID}'
]
```

Usage
-----

[](#usage)

Refer to the source code for other functionality or create a pull request for addition of functionality. I will endeavour to keep adding features whenever I can.

### Normal

[](#normal-1)

Instantiate

```
$codecombat = new CodeCombat(
	{CLIENT_ID},
	{CLIENT_SECRET},
	{OAUTH_PROVIDER_ID});
```

Create a new user

```
$user = {A user from your system}
$combatUser = $codecombat->register([
    'name' => $user->name, // UNIQUE Nick Name
    'email' => $user->email, // NEW Email,
    'role' => 'student' //or 'teacher'
]);
```

Assign an OAuth Identity

```
$token = {YOUR OAuth2 token, generated for your user from your server}
$codecombat->setAuth($token)->createIdentity($combatUser);
```

Retrieve the user later

```
$handle = {UNIQUE Nick Name assigned earlier or the CodeCombat ID of the user, if you have it}
$combatUser = $codecombat->getUser($handle);
```

Get the url to redirect to CodeCombat

```
$token = {YOUR OAuth2 token, generated for your user from your server}
$url = $codecombat->setAuth($token)->redirect();
```

The `TimuTech\CodeCombat\Resources\CombatUser` class has some helpful methods and attributes, to name a few:

```
$combatUser->getEmail();
$combatUser->getId();
$combatUser->getProfile();
```

Once again, the source code is your friend.

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity57

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~17 days

Recently: every ~73 days

Total

21

Last Release

2968d ago

PHP version history (2 changes)v0.1.1PHP &gt;=5.6.4

v0.5.2PHP ^7.1.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/fd02e70371a59da0972cbb4275c5b02bdbb23dec4ae3ed168895b6e3c40957ae?d=identicon)[xanmanza](/maintainers/xanmanza)

---

Top Contributors

[![XanManZA](https://avatars.githubusercontent.com/u/12627519?v=4)](https://github.com/XanManZA "XanManZA (1 commits)")

### Embed Badge

![Health badge](/badges/timutech-codecombat-api/health.svg)

```
[![Health](https://phpackages.com/badges/timutech-codecombat-api/health.svg)](https://phpackages.com/packages/timutech-codecombat-api)
```

###  Alternatives

[skagarwal/google-places-api

Google Places Api

1913.0M8](/packages/skagarwal-google-places-api)[dcblogdev/laravel-microsoft-graph

A Laravel Microsoft Graph API (Office365) package

168285.5k1](/packages/dcblogdev-laravel-microsoft-graph)[vluzrmos/slack-api

Wrapper for Slack.com WEB API.

102589.1k3](/packages/vluzrmos-slack-api)[smodav/mpesa

M-Pesa API implementation

16363.7k1](/packages/smodav-mpesa)[jasara/php-amzn-selling-partner-api

A fluent interface for Amazon's Selling Partner API in PHP

1344.8k1](/packages/jasara-php-amzn-selling-partner-api)[grantholle/powerschool-api

A Laravel package to make interacting with PowerSchool less painful.

1715.6k1](/packages/grantholle-powerschool-api)

PHPackages © 2026

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