PHPackages                             lamansky/api - 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. [HTTP &amp; Networking](/categories/http)
4. /
5. lamansky/api

ActiveLibrary[HTTP &amp; Networking](/categories/http)

lamansky/api
============

Lets you create REST APIs using PHP classes to represent API endpoints.

2.0.1(4y ago)033MITPHPPHP &gt;=7.4.0

Since Nov 30Pushed 4y ago1 watchersCompare

[ Source](https://github.com/lamansky/api)[ Packagist](https://packagist.org/packages/lamansky/api)[ Docs](https://github.com/lamansky/api)[ RSS](/packages/lamansky-api/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependencies (3)Versions (5)Used By (0)

Lamansky/Api
============

[](#lamanskyapi)

Lets you create REST APIs using PHP classes to represent API endpoints.

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

[](#installation)

With [Composer](http://getcomposer.org) installed on your computer and initialized for your project, run this command in your project’s root directory:

```
composer require lamansky/api
```

Requires PHP 7.4 or above.

Usage Tutorial
--------------

[](#usage-tutorial)

### Introduction

[](#introduction)

An endpoint is a URL (or URL pattern) that can receive REST commands. Every endpoint in your API will be represented by a PHP class. This PHP class implements an `Endpoint` interface appropriate to the types of REST commands it can accept.

GETPOSTPUTDELETE`CollectionEndpoint`✔✔`ItemEndpoint`✔✔✔`ReadOnlyEndpoint`✔Each REST command is implemented as a public method of the endpoint controller:

```
