PHPackages                             mlabate/restful-codeigniter - 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. mlabate/restful-codeigniter

ActiveLibrary[API Development](/categories/api)

mlabate/restful-codeigniter
===========================

Rest Server for CodeIgniter

00PHP

Since Nov 1Pushed 5y ago1 watchersCompare

[ Source](https://github.com/mlabate/restful-codeigniter)[ Packagist](https://packagist.org/packages/mlabate/restful-codeigniter)[ RSS](/packages/mlabate-restful-codeigniter/feed)WikiDiscussions main Synced 6d ago

READMEChangelogDependenciesVersions (1)Used By (0)

CodeIgniter RESTful Server
==========================

[](#codeigniter-restful-server)

[![StyleCI](https://camo.githubusercontent.com/02550895ecbc4637bb8b21d87a675405ee58d51670de1f192305bcac67d94743/68747470733a2f2f6769746875622e7374796c6563692e696f2f7265706f732f3233303538392f736869656c643f6272616e63683d6d6173746572)](https://github.styleci.io/repos/230589)

RESTful server implementation for CodeIgniter

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

[](#requirements)

- PHP 7.2 or greater
- CodeIgniter 3.1.11+

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

[](#installation)

```
composer require mlabate/restful-codeigniter
```

Usage
-----

[](#usage)

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

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

```
use mlabate\RestServer\RestController;
```

Step 2: Extend your controller

```
class Example extends RestController
```

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

[](#basic-get-example)

The following sample controller (saved as `Api.php`) can be called in two ways: &lt;&gt;

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

```
