erpk/harserver

There is no license information available for the latest version (v0.2.0) of this package.

v0.2.0 2013-09-09 09:35 UTC

README

Introduction

Harserver is standalone webserver which allows you host your own API service locally. It's useful, if you need to use Harvester library, but your application is not written in PHP.

Harserver can also work with Apache2 or nginx.

Installation

sudo apt-get update
sudo apt-get install git curl php5-cli php5-curl php5-sqlite
mkdir harserver && cd harserver/
curl -sS https://getcomposer.org/installer | php
php composer.phar create-project --stability=dev erpk/harserver harserver/
mv composer.phar harserver/ && cd harserver/

Composer will check your PHP configuration and download required dependencies. It may take several minutes.

Get started

###Configuration Firstly, you need configure your eRepublik account. Run command below and follow the instructions:

php bin/harserver.php config

When finished, it create config.json in main application directory.

###Use as standalone application To run your API webserver, execute following command:

php bin/harserver.php run --port=1337

Now you can access resources under http://localhost:1337/

###Use with webserver (Apache/nginx) You can access resources under http://localhost/harserver/public/index.php

Examples

List of resources can be found in src/Erpk/Harserver/routing.yml

standalone:
http://localhost:1337/citizen/profile/123456.json
http://localhost:1337/citizen/profile/123456.xml
http://localhost:1337/citizen/search/romper/1.json
http://localhost:1337/exchange/gold/1.json
http://localhost:1337/exchange/cc/1.json
http://localhost:1337/market/PL/weapons/7/1.xml

webserver:
http://localhost/harserver/public/citizen/profile/123456.json
http://localhost/harserver/public/citizen/profile/123456.xml
http://localhost/harserver/public/citizen/search/romper/1.json
http://localhost/harserver/public/market/PL/weapons/7/1.xml