boxedlunch-us / Tera-PHP-Custom-API

Launcher<->Server API for Tera Pserver 92.03 | 100.2

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Light framework aimed toward APIs

(It doesn't have a goal to be usable for real, it's only for learning purposes)
Only compatible with php >8.0

First, need to do a composer install.

  • app - Contains Controllers and Models.
  • controllers - The Controller is usually called by your Routes.
  • models - Contains the Database logic for a table mostly called by Controller to get database informations or specific class methods.
  • core - The core files of the framework.
  • public - Where the magic is done.
  • routes - Contain your routes, linked either to a function or a Closure.
  • database - Contains migrations/ folder in which we can store the SQL files to migrate

Manager

Is called with php manager -
It's a kind of artisan like laravel uses, you can generate Models or Controllers (more to come).

The prototype is as followed : php manager @action @args[]

Example Commands

Controller and Model commands automatically extends to default, a way to override will be done later.
To create a new Controller
php manager controller UserController

To create a new Model
php manager model User

To add multiple routes to api.php at once (the method argument is case insensitive)
php manager route add GET,/home POST,/register,RegisterController@execute

To create a token if authKey is activated, if it worked, token will be output in CLI
php manager authKey create

You can use php manager to have a list of all possible commands.

E2E with codecept

run php vendor\codeception\codeception\codecept run

More tests can be added for new API routes into file test/ApiCest.php

About

Launcher<->Server API for Tera Pserver 92.03 | 100.2


Languages

Language:PHP 100.0%