sectoroverload2k/rest-router

PHP Library for REST API

Installs: 47

Dependents: 1

Suggesters: 0

Security: 0

Stars: 0

Watchers: 2

Forks: 0

Open Issues: 0

pkg:composer/sectoroverload2k/rest-router

1.1.4 2025-11-11 22:59 UTC

This package is auto-updated.

Last update: 2025-12-11 23:05:31 UTC


README

This code provides the basic framework for a PHP developer that wants to build a REST service. Some of the features provided in this framework are:

  • API Authentication
  • Multiple request methods
    • GET
    • POST
    • PUT
    • DELETE
  • Custom URL routing to support variables

Controller Versions, Classes and Actions

/controllers/version/controller/action Example Request: GET /v1/home/index

  • Default version is v1
  • Default controller class is home
  • Default action is index

##The REST Router will do the following:

  • try to find a folder called v1 in the /controllers folder.
  • Load home controller in file /controllers/v1/home.php
  • Because this is a GET request, it will try to following:
    • check for a class method called get_index and run it
    • if not found, it will search for index and run it
    • if not found, it will return an error

Request Methods

  • GET
  • POST
  • PUT
  • DELETE