PHPackages                             slimphp-api/slim-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. [API Development](/categories/api)
4. /
5. slimphp-api/slim-api

ActiveLibrary[API Development](/categories/api)

slimphp-api/slim-api
====================

Tool for generating slim api controllers/models

0.1.2(10y ago)103581[11 issues](https://github.com/slimphp-api/slim-api/issues)3MITPHPPHP &gt;5.6

Since Jan 12Pushed 10y ago3 watchersCompare

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

READMEChangelog (3)Dependencies (8)Versions (3)Used By (3)

\#slim-api Basic slim api project and generator

[![Coverage Status](https://camo.githubusercontent.com/ba451cd1d47f0ee271cedfe697c057928e3e4b514881590bde7a8c067b4c34f5/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f736c696d7068702d6170692f736c696d2d6170692f62616467652e7376673f6272616e63683d6d617374657226736572766963653d676974687562)](https://coveralls.io/github/slimphp-api/slim-api?branch=master)[![Code Climate](https://camo.githubusercontent.com/04b5e2712e20ea0a57aee491e768a212bcf3438d2b5306092b1bbe446616ac9e/68747470733a2f2f636f6465636c696d6174652e636f6d2f6769746875622f736c696d7068702d6170692f736c696d2d6170692f6261646765732f6770612e737667)](https://codeclimate.com/github/slimphp-api/slim-api)[![Build Status](https://camo.githubusercontent.com/706136b17444e3b270e9077029e2fb0fe58d23fbedc6432c9de1660cf79a1577/68747470733a2f2f7472617669732d63692e6f72672f736c696d7068702d6170692f736c696d2d6170692e737667)](https://travis-ci.org/slimphp-api/slim-api)

\#Status

Alpha, init and create models/controllers/scaffolds is complete.

\#What?

A simple command line app for producing simple controllers/models/migrations, routes and DI, using Slim and symfony console.

\###External modules By default the app uses phinx and eloquent for migrations and ORM, these are provided by external modules: [slim-eloquent](https://github.com/slimphp-api/slim-eloquent) and [slim-phinx](https://github.com/slimphp-api/slim-phinx)

\#Why?

I wanted to be able to create API end points as easily as possible, and I love the simplicity of Slim, and after a sordid time with RoR this seemed like a fun thing to do!

\#How?

\###Installation

Install globally within your user account `composer global require slimphp-api/slim-api dev-master`
Make sure global composer is in your path `export PATH=~/.composer/vendor/bin:$PATH` in .bashrc

\###Init

Basic useage is simple, we first have to initiate the project, this creates a default skeleton for the project and initiates the phinx configuration.

```
slimapi init  [location]

```

Location defaults to the cwd if not specified.

If you use a different migration/orm/structure module you'll then have to re-init the appropriate source, such as:

```
slimapi init:db

```

This must be done from the root or your project after the init.

\###Models

We can then generate a model, this creates a migration, a simple model class and DI configuration.

```
slimapi generate model

```

Model definitions are a space seperated list of column definitions, of the form `name:type:limit:null:unique`, so

```
slimapi generate model Foo bar:integer baz:string:128:false bazbar:string:128::true

```

Would create a migration of 3 columns, baz would have a character limit and can't be null, bazbar would have a character limit and must be unique.

\###Controllers

We can create a controller, this creates a simple controller, route and DI configuration.

```
slimapi generate controller  [methods]

```

Methods defaults to index, get, post, put and delete and are empty by default. The controller name influences how the route is designed.

```
slimapi generate controller Foo index post

```

Would generate a controller named Foo with empty methods index and post. It would also create the GET/POST `/foo` route.

```
slimapi generate controller Foo

```

Would generate a controller named Foo with empty methods index, get, post, put, delete. It would also create the GET/POST `/foo` routes and the GET/PUT/DELETE `/foo/{id}` routes.

\###Scaffold

Scaffolding combines controller and model generation but with added jazz. It configures the controller to receive the model as a constructor param, configures the DI to inject the model to the controller and finally populates the normally empty controller methods with basic CRUD functionality. You can't provide arguments to specify controller methods (it creates them all), but you can supply your model definition.

```
slimapi generate scaffold foo field1:integer field2:string

```

This would generate the Foo controller and appropriate routes, the Foo model/migration with field1/field2 as fillables and any required DI configuration.

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance0

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity49

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 ~0 days

Total

3

Last Release

3770d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/8eead2f413dc6c16192320a2529534ed3f145c4f523fcadcc6af85c6be578f2c?d=identicon)[gabriel403](/maintainers/gabriel403)

---

Top Contributors

[![gabriel403](https://avatars.githubusercontent.com/u/118638?v=4)](https://github.com/gabriel403 "gabriel403 (132 commits)")

---

Tags

apigeneratorslimslimapi

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/slimphp-api-slim-api/health.svg)

```
[![Health](https://phpackages.com/badges/slimphp-api-slim-api/health.svg)](https://phpackages.com/packages/slimphp-api-slim-api)
```

###  Alternatives

[apigen/apigen

PHP source code API generator.

2.2k627.9k223](/packages/apigen-apigen)[ufo-tech/json-rpc-sdk-bundle

The Symfony bundle for simple usage Json-RPC api with dynamic SDK

172.5k](/packages/ufo-tech-json-rpc-sdk-bundle)

PHPackages © 2026

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