Download the PHP package timutech/codecombat-api without Composer
On this page you can find all versions of the php package timutech/codecombat-api. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download timutech/codecombat-api
More information about timutech/codecombat-api
Files in timutech/codecombat-api
Package codecombat-api
Short Description Package for codecombat.com REST API
License MIT
Informations about the package codecombat-api
codecombat-api
PHP package for CodeCombat REST API
codecombat-api is a package for the CodeCombat 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 for more details and do not be afraid to peruse the source code on this package.
Installation
composer require timutech/codecombat-api
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
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
Add the line TimuTech\CodeCombat\CodeCombatserviceProvider::class,
like below in your config/app.php
file.
Add your CodeCombat OAuth credentials to your config/services.php
file, as below.
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
Instantiate
Create a new user
Assign an OAuth Identity
Retrieve the user later
Get the url to redirect to CodeCombat
The TimuTech\CodeCombat\Resources\CombatUser
class has some helpful methods and attributes, to name a few:
Once again, the source code is your friend.