PHP Classes

File: README.md

Recommend this page to a friend!
  Classes of Kamil  >  PHP API Tutorial Training Server  >  README.md  >  Download  
File: README.md
Role: Documentation
Content type: text/markdown
Description: Documentation
Class: PHP API Tutorial Training Server
Implementation of a REST API for learning purposes
Author: By
Last change:
Date: 2 months ago
Size: 2,331 bytes
 

Contents

Class file image Download

Training server for RestControl

TrainingServer contains several REST endpoints e.q. with oAuth/basic authentication, which you can use for learning RestControl.

Installation

 make build
 make first-run

Start server

 make start

Usage

 # Run all tests
 make run-tests

Endpoints

-> Plain api(without any authorization)

(GET) http://IP_ADDR/plain/users

Sample response:

[
  [
      "id": 1,
      "name": "Sample name",
      "email": "sample@email.com",
      "password": "sample_long_password_string",
      "remember_token": null,
      "created_at": "2018-01-01 10:00:00",
      "updated_at": "2018-01-01 10:00:00",
  ],
  [
      "id": 2,
      "name": "Sample name",
      "email": "another@email.com",
      "password": "sample_long_password_string",
      "remember_token": null,
      "created_at": "2018-01-01 10:00:00",
      "updated_at": "2018-01-01 10:00:00",
  ],
]

(GET) http://ID_ADDR/plain/files/csv (GET) http://ID_ADDR/plain/files/css (GET) http://ID_ADDR/plain/files/js (GET) http://ID_ADDR/plain/files/png (GET) http://ID_ADDR/plain/cookies

-> Basic auth

(GET) http://IP_ADDR/basi-auth

Sample response:

 [
    "status": "ok"
 ]

-> oAuth2 Endpoints

(POST) http://IP_ADDR/oauth2/token

> Form params: > - grant_type(optional): password, client_credentials > - client_id: string > - client_secret: string > - username: string > - password: string > - scope(optional): string > > Seeds: > - Password grant client > - client_id: 10 > - client_secret: F0NVue12qNwayx3pKJLHfJmQouOZg40YZafjjdHZ

(GET) http://ID_ADDR/oauth2/users - Return list of users.

>Headers: > - Content-Type: application/json > - Authorization: Bearer ACCESS_TOKEN > >

Sample response:

[
  [
      "id": 1,
      "name": "Sample name",
      "email": "sample@email.com",
      "password": "sample_long_password_string",
      "remember_token": null,
      "created_at": "2018-01-01 10:00:00",
      "updated_at": "2018-01-01 10:00:00",
  ],
  [
      "id": 2,
      "name": "Sample name",
      "email": "another@email.com",
      "password": "sample_long_password_string",
      "remember_token": null,
      "created_at": "2018-01-01 10:00:00",
      "updated_at": "2018-01-01 10:00:00",
  ],
]
For more information send a message to info at phpclasses dot org.