PHPackages                             cabreran/ci-hmvc-restserver - 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. [API Development](/categories/api)
4. /
5. cabreran/ci-hmvc-restserver

ActiveLibrary[API Development](/categories/api)

cabreran/ci-hmvc-restserver
===========================

CodeIgniter HMVC Rest Server

v3.0.1(5y ago)01951MITPHPPHP &gt;= 7.1

Since Jul 17Pushed 5y ago1 watchersCompare

[ Source](https://github.com/cabreran/ci-hmvc-restserver)[ Packagist](https://packagist.org/packages/cabreran/ci-hmvc-restserver)[ Docs](https://github.com/cabreran/ci-hmvc-restserver)[ RSS](/packages/cabreran-ci-hmvc-restserver/feed)WikiDiscussions master Synced today

READMEChangelog (1)DependenciesVersions (2)Used By (0)

CodeIgniter HMVC Rest Server
============================

[](#codeigniter-hmvc-rest-server)

A fully RESTful server implementation for CodeIgniter HMVC using one library, one config file and one controller.

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

[](#requirements)

- PHP 7.2 or greater
- CodeIgniter 3.1.11+
- HMVC

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

[](#installation)

```
composer require cabreran/ci-hmvc-restserver
```

Usage
-----

[](#usage)

CodeIgniter HMVC Rest Server is available on [Packagist](https://packagist.org/packages/cabreran/ci-hmvc-restserver) (using semantic versioning), and installation via composer is the recommended way to install Codeigniter Rest Server. Just add this line to your `composer.json` file:

```
"cabreran/ci-hmvc-restserver": "^3.1"
```

or run

```
composer require cabreran/ci-hmvc-restserver
```

Note that you will need to copy `rest.php` to your `config` directory (e.g. `application/config`)

Step 1: Add this to your controller (should be before any of your code)

```
use Cabreran\RestServer\RestController;
```

Step 2: Extend your controller

```
class Example extends RestController
```

Basic GET example
-----------------

[](#basic-get-example)

Here is a basic example. This controller, which should be saved as `Api.php`, can be called in two ways:

- `http://domain/api/users/` will return the list of all users
- `http://domain/api/users/id/1` will only return information about the user with id = 1

```
