webfiori/http

Basic library that can help in creating RESTful APIs using PHP.

Maintainers

Details

github.com/WebFiori/http

Source

Issues

Fund package maintenance!
paypal.me/IbrahimBinAlshikh


README

A simple library for creating RESTful web APIs in adition to providing utilities for handling HTTP request and response. It includes inputs feltering and data validation in addion to creating user-defined inputs filters.

badge.svg?branch=master 68747470733a2f2f636f6465636f762e696f2f67682f57656246696f72692f687474702f6272616e63682f6d61737465722f67726170682f62616467652e737667 68747470733a2f2f736f6e6172636c6f75642e696f2f6170692f70726f6a6563745f6261646765732f6d6561737572653f70726f6a6563743d57656246696f72695f68747470266d65747269633d616c6572745f737461747573 68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f57656246696f72692f687474702e7376673f6c6162656c3d6c6174657374 68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f77656266696f72692f687474703f636f6c6f723d6c696768742d677265656e

Supported PHP Versions

Build Status
badge.svg?branch=master
badge.svg?branch=master
badge.svg?branch=master
badge.svg?branch=master
badge.svg?branch=master
badge.svg?branch=master
badge.svg?branch=master
badge.svg?branch=master
badge.svg?branch=master

API Docs

This library is a part of WebFiori Framework. To access API docs of the library, you can visid the following link: https://webfiori.com/docs/webfiori/http .

Terminology

Following terminology is used by the library:

Term Definition
Web Service A single end pont that implements a REST service. It is represented as an instance of the class AbstractWebService.
Services Manager An entity which is used to manage a set of web services. Represented by the class WebServicesManager.
Request Parameter A way to pass values from a client such as a web browser to the server. Represented by the class RequestParameter.

The Idea

The idea of the library is as follows, when a client performs a request to a web service, he is usually intersted in performing specific action. Related actions are kept in one place as a set of web services (e.g. CRUD operations on a reasorce). The client can pass arguments (or parameters) to the end point in request body as POST or PUT request method or as a query string when using GET or DELETE.

An end point is represented by the class AbstractWebService and a set of web service (or end ponts) are grouped using the class WebServicesManager. Also, body parameters represented by the class RequestParameter.

Features

  • Full support for creating REST services that supports JSON as request and response.
  • Support for basic data filtering and validation.
  • The ability to create custom filters based on the need.

Installation

If you are using composer to collect your dependencies, you can simply include the following entry in your 'composer.json' file to get the latest release of the library:

{
    "require": {
        "webfiori/http":"*"
    }
}

Note that the WebFiori Json library will be included with the installation files as this library is depending on it.

Another option is to download the latest release manually from Release.

Usage

For more information on how to use the library, check here