PHPackages                             vince-scarpa/responsibleapi - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. vince-scarpa/responsibleapi

ActiveApplication[Authentication &amp; Authorization](/categories/authentication)

vince-scarpa/responsibleapi
===========================

1.4(5y ago)110.8k↑216.7%MITPHPPHP &gt;=5.5.0CI failing

Since Jun 14Pushed 7mo ago2 watchersCompare

[ Source](https://github.com/vince-scarpa/responsibleAPI)[ Packagist](https://packagist.org/packages/vince-scarpa/responsibleapi)[ Docs](https://github.com/vince-scarpa/responsibleAPI)[ RSS](/packages/vince-scarpa-responsibleapi/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (3)Versions (9)Used By (0)

[![Scrutinizer Code Quality](https://camo.githubusercontent.com/cda0a9209149dd180665a606482189c9f42aa28dd1740450faba9e3679f176e1/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f76696e63652d7363617270612f726573706f6e7369626c654150492f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/vince-scarpa/responsibleAPI/?branch=master)[![Build Status](https://camo.githubusercontent.com/002ffe70a52901a5b977ac479749edf55109eb0212dd21f1f00b6a02177ea577/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f76696e63652d7363617270612f726573706f6e7369626c654150492f6261646765732f6275696c642e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/vince-scarpa/responsibleAPI/build-status/master)[![Packagist Downloads](https://camo.githubusercontent.com/cee37be2e6212531961691352a22e0cac0bc97c4ee16dbaa07759dec9c6b5041/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646d2f76696e63652d7363617270612f726573706f6e7369626c65617069)](https://camo.githubusercontent.com/cee37be2e6212531961691352a22e0cac0bc97c4ee16dbaa07759dec9c6b5041/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646d2f76696e63652d7363617270612f726573706f6e7369626c65617069)

ResponsibleAPI RESTful API
==========================

[](#responsibleapi-restful-api)

Responsible API is a secure PHP RESTful application that allows easy HTTP requests from
external requests fused by Json Web Tokens (JWT).
[ResponsibleSDK](https://github.com/vince-scarpa/responsibleSDK "ResponsibleAPI software development kit") is recommended to connect to the ResponsibleAPI\\

### Development

[](#development)

Version 1.4
This repo is open for contributions.

Features include:

1. **JWT**

    - to sign each request
2. **Rate limiting**

    - to limit requests to a timed window frame and options to allow unlimited requests
3. **The Leaky bucket algorithm**

    - used for request throttling

Requirements
------------

[](#requirements)

PHP 7.x
[Composer](https://getcomposer.org/doc/00-intro.md "Composer install")
[ResponsibleSDK](https://github.com/vince-scarpa/responsibleSDK "ResponsibleAPI software development kit") \[recommended\]

Installation
------------

[](#installation)

Install composer if not already

Install ResponsibleSDK \[recommended for quick example\]

```
$ cd
$ git clone https://github.com/vince-scarpa/responsibleAPI.git
$ composer install

```

Setup
-----

[](#setup)

In order for the ResponsibleAPI to initiate we need to add some basic configurations

1. Import the example sql file
2. Use or Create a `.config` file

### Setup your storage

[](#setup-your-storage)

The ResponsibleAPI uses MySQL as Database storage, run the supplied `responsible.sql` file to install the required tables

### Setup a config file

[](#setup-a-config-file)

If you didn't get a `.config` file shipped in this repo then you'll need to create one.
In the repo root directory run the following or anyway you know to create and write to files

```
$ cd
$ mkdir config
$ touch config/.config

```

Your file structure should look like this

- responsibleAPI
    - config
        - .config
    - src
        - (...)

Edit your new `.config` file and paste the below code, change all credentials to reflect your storage
Note: The MASTER\_KEY is the global "secret key" for system use to sign requests.
To generate a strong secret I recommend using a strong password generator, this has no length limit but do note you probably want to stick to 32bytes. The only tested characters are;

```
ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789`-=~!@#$%^&*()_+,./?;[]{}\|

```

```
DB_TYPE = 'mysql'
DB_PORT = '3306'
DB_NAME = ''
DB_USER = ''
DB_PASSWORD = ''
DB_HOST = ''

MASTER_KEY = ''

```

Basic usage
-----------

[](#basic-usage)

#### Setting up our API server

[](#setting-up-our-api-server)

```
