PHPackages                             palanik/restslim - 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. palanik/restslim

ActiveLibrary[API Development](/categories/api)

palanik/restslim
================

Minimalist REST framework for PHP Slim.

v0.1.0(11y ago)058MITPHP

Since Oct 13Pushed 11y ago1 watchersCompare

[ Source](https://github.com/palanik/RestSlim)[ Packagist](https://packagist.org/packages/palanik/restslim)[ Docs](https://github.com/palanik/RestSlim)[ RSS](/packages/palanik-restslim/feed)WikiDiscussions master Synced 4d ago

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

RestSlim
========

[](#restslim)

[![Latest Stable Version](https://camo.githubusercontent.com/23e8e77d41b7025eb428c745eb677c075cc5a8b1f7e6885960d0874931a3d12d/68747470733a2f2f706f7365722e707567782e6f72672f70616c616e696b2f72657374736c696d2f762f737461626c652e737667)](https://packagist.org/packages/palanik/restslim)[![License](https://camo.githubusercontent.com/f4f71e0b5c363f271b94298b6ceccc9f2819c640a877e820d367b4bba23f7333/68747470733a2f2f706f7365722e707567782e6f72672f70616c616e696b2f72657374736c696d2f6c6963656e73652e737667)](https://packagist.org/packages/palanik/restslim)

Minimalist REST framework for [Slim](http://www.slimframework.com/).

[Slim](https://github.com/codeguy/Slim) is a PHP micro framework that helps you quickly write simple, yet powerful web applications and APIs.

Shift your focus from Routes to Resources, while building RESTful API with PHP Slim.

\##Installation You can install via composer. Add this to your composer.json

```
{
  "require": {
    "slim/slim": "2.4.*",
    "palanik/restslim": "0.1.*"
  }
}
```

Greetings Tutorial
------------------

[](#greetings-tutorial)

```
$app = new \Slim\Slim();

// This should obviously go in a datastore
$data = array();
$data["1"] = array("id" => 1,
                "message" => "Hello, World!");
$data["2"] = array("id" => 2,
                "message" => "Good Bye!");

$greetings = new \RestSlim\RestSlim("greetings");

// List
$greetings->list(function() use ($app, $data) {
    $app->response->headers->set('Content-Type', 'application/json');
    $app->response->write(json_encode($data, JSON_NUMERIC_CHECK));
});

// Read
$greetings->get(function($id) use ($app, $data) {
    $app->response->headers->set('Content-Type', 'application/json');
    $app->response->write(json_encode($data[$id], JSON_NUMERIC_CHECK));
});

// Create
$greetings->create(function() use ($app, $data) {
	$request = $app->request();
	$message = json_decode($request->getBody(), true);
	$id = count($data) + 1;
	$message["id"] = $id;
	$data[$id] = $message;
    $app->response->headers->set('Content-Type', 'application/json');
    $app->response->write(json_encode($data, JSON_NUMERIC_CHECK));
})
// Update
$greetings->update(function($id) use ($app, $data) {
	$request = $app->request();
	$message = json_decode($request->getBody(), true);
	$message["id"] = $id;
	$data[$id] = $message;
    $app->response->headers->set('Content-Type', 'application/json');
    $app->response->write(json_encode($data, JSON_NUMERIC_CHECK));
})
// Delete
->delete(function($id) use ($app, $data) {
    $app->response->headers->set('Content-Type', 'application/json');
    $app->response->write(json_encode($data[$id], JSON_NUMERIC_CHECK));
    unset($data[$id]);
});

// Inject into Slim
$greetings->app($app)
            ->run();
```

Slim applications are built by mapping routes to callback functions for specific HTTP request methods. But, RESTFul APIs are more about resources and actions on the resources, than about the routes. RestSlim brings the two together. It enhances Slim in creating RESTful applications with ease.

Create action oriented, restful resources independently and then inject them to your Slim application. Add multiple resources to the same Slim app.

Although, you create your resources independently, RestSlim integrates with a Slim application to serve the resources.

RestSlim adheres to Slim framework's guiding principle: Cleanliness over terseness and common cases over edge cases.

License
-------

[](#license)

[MIT](LICENSE)

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~5 days

Total

2

Last Release

4226d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1656913?v=4)[Palani Kumanan](/maintainers/palanik)[@palanik](https://github.com/palanik)

---

Top Contributors

[![palanik](https://avatars.githubusercontent.com/u/1656913?v=4)](https://github.com/palanik "palanik (15 commits)")

---

Tags

apislimslimphprestfulrestslim

### Embed Badge

![Health badge](/badges/palanik-restslim/health.svg)

```
[![Health](https://phpackages.com/badges/palanik-restslim/health.svg)](https://phpackages.com/packages/palanik-restslim)
```

###  Alternatives

[gotzmann/comet

Modern PHP framework for building blazing fast REST APIs and microservices

68816.2k1](/packages/gotzmann-comet)[teepluss/api

Laravel 4 Internal Request (HMVC)

7034.0k](/packages/teepluss-api)[b13/slimphp-bridge

Provides a middleware for registering Slim PHP applications within TYPO3 Frontend Sites

2047.2k1](/packages/b13-slimphp-bridge)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
