Download the PHP package rikudou/my-colony-api without Composer
On this page you can find all versions of the php package rikudou/my-colony-api. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download rikudou/my-colony-api
More information about rikudou/my-colony-api
Files in rikudou/my-colony-api
Package my-colony-api
Short Description OOP wrapper around My Colony API
License WTFPL
Homepage https://github.com/RikudouSage/MyColonyAPI
Informations about the package my-colony-api
My Colony PHP Api
This is an OOP wrapper around My Colony public API. Requires php 7.2+.
Installation
Install via composer:
composer require rikudou/my-colony-api
Usage
Simply create an instance of the api:
Sector Info
The findSector()
method returns instance of class MyColony\Request\SectorMapRequest
.
Parameters:
- x position (
setXCoordinate()
orsetXYCoordinates()
) - required - y position (
setYCoordinate()
orsetXYCoordinates()
) - required - limit (
setLimit()
) - limits how many colonies to return - only independent (
onlyIndependent()
) - whether to return only independent colonies
Colony Info
The getColonyInfo()
method returns instance of MyColony\Request\ColonyInfoRequest
Parameters:
- charter code (
setCharterCode()
) - required
GBT Prices
The getGbtPrices()
method returns instance of MyColony\Request\GbtPricesRequest
Parameters: none
GBT Contracts
The getGbtContracts()
return instance of MyColony\Request\GbtContractsRequest
Parameters:
- resource id (
setResourceId
) - can be taken fromMyColony\Enum\GbtResourceIds
Enums
There are some enums to assist you.
Civilizations
Class: MyColony\Enum\Civilizations
Description: Contains list of civilizations
GBT Resource IDs
Class: MyColony\Enum\GbtResourceIds
Description: Contains ids of all resources, also contains static method findByName()
.
GBT Resource Names
Class: MyColony\Enum\GbtResourceNames
Description: Contains names of all resources, also contains static method findById()
.
Map Types
Class: MyColony\Enum\MapType
Description: Contains names of map types. This enum is incomplete.
Races
Class: MyColony\Enum\Race
Description: Contains names of races in game.
Exceptions
List of arguments that can be thrown:
\InvalidargumentException
- when you input id that doesn't exist, name that doesn't exist etc.MyColony\Exception\RequiredParametersMissingException
- when some request class doesn't have required parameters set\RuntimeException
or\LogicException
- in all other cases