PHPackages                             patricksavalle/slim-rest-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. [Framework](/categories/framework)
4. /
5. patricksavalle/slim-rest-api

ActiveLibrary[Framework](/categories/framework)

patricksavalle/slim-rest-api
============================

Production-grade REST-API App-class for PHP SLIM, in production on https://zaplog.pro (https://api.zaplog.pro/v1)

v1.7(3y ago)101.4k2MITPHPPHP &gt;=8.0

Since Apr 30Pushed 3y ago3 watchersCompare

[ Source](https://github.com/patricksavalle/slim-rest-api)[ Packagist](https://packagist.org/packages/patricksavalle/slim-rest-api)[ Docs](https://github.com/patricksavalle/slim-rest-api)[ RSS](/packages/patricksavalle-slim-rest-api/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (4)Dependencies (3)Versions (6)Used By (0)

Ready-to-go REST API for PHP SLIM
---------------------------------

[](#ready-to-go-rest-api-for-php-slim)

*Uses PHP 7.x syntax*

Turns the default SLIM App-class into a production-grade JSON REST-API base-class:

- adds (GET, POST and header) parameter validation for added security and self-documentation
- adds robust exception and assert handling / sets-up the PHP interpreter for exceptions so 'normal' errors will throw exceptions that you can catch.
- translates unhandled exceptions into 'normal' JSON-responses with the correct HTTP-STATUS
- translates unknown routes/URL's and methods into 'normal' 403 and 404 JSON-responses
- CLI support to accept and protect for instance cronjob calls from the server
- Middleware for database optimisation and memcache support
- Query caching (using APCu)

Very simple to use, just use the SlimRestApi-class instead of the standard Slim App-class.

Edit the ***`slim-rest-api.ini`*** for correct (database) configuration.

Example ***`index.php`***:

```
