PHPackages                             mixerapi/cakephp-rest - 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. mixerapi/cakephp-rest

ActiveCakephp-plugin[API Development](/categories/api)

mixerapi/cakephp-rest
=====================

The missing RESTful API component to CakePHP's bake console. Create RESTful API skeletions in seconds.

v2.0.4(3y ago)332MITPHPPHP ^8.0

Since Jul 10Pushed 6mo ago1 watchersCompare

[ Source](https://github.com/mixerapi/rest)[ Packagist](https://packagist.org/packages/mixerapi/cakephp-rest)[ RSS](/packages/mixerapi-cakephp-rest/feed)WikiDiscussions master Synced 1w ago

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

MixerApi REST
=============

[](#mixerapi-rest)

[![Latest Version on Packagist](https://camo.githubusercontent.com/c99cc3933e39b9dc13670d9be2cfa9c766dc57b4ee27f2bf2f97bd095287e4b0/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d697865726170692f63616b657068702d726573742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/mixerapi/cakephp-rest)[![Build](https://github.com/mixerapi/mixerapi-dev/workflows/Build/badge.svg?branch=master)](https://github.com/mixerapi/mixerapi-dev/actions?query=workflow%3ABuild)[![Coverage Status](https://camo.githubusercontent.com/980eb71f87b8f84d118d946d1a90203dbc53bbc8ac87363bc543899b32c0d2a0/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f6d697865726170692f6d697865726170692d6465762f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/mixerapi/mixerapi-dev?branch=master)[![MixerApi](https://camo.githubusercontent.com/bca1ea90642661e0908fc7ad1c1cdbd704cda1063a2cb40801fab9d0ccdbd6af/68747470733a2f2f6d697865726170692e636f6d2f6173736574732f696d672f6d697865722d6170692d7265642e737667)](https://mixerapi.com)[![CakePHP](https://camo.githubusercontent.com/21b7bf61684c39eabf40bb424dd733f6f3a4bd11de430f8accc24ba0445b4b9b/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f63616b657068702d253545342e322d7265643f6c6f676f3d63616b65706870)](https://book.cakephp.org/4/en/index.html)[![Minimum PHP Version](https://camo.githubusercontent.com/7f2179949cf3def20f5d08c400d94cf1c6c68c30bdaa05546c78e33eccded56f/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253545382e302d3838393242462e7376673f6c6f676f3d706870)](https://php.net/)

This plugin gets your API project up and going quickly by creating routes for you.

- Build your `routes.php` file from a single command or automatically expose RESTful CRUD routes with a handy AutoRouter.
- Set default HTTP status codes for CRUD operations

This plugin assumes you have already created models and controllers. For help with the latter check out [MixerApi/Bake](https://github.com/mixerapi/bake). Check the official [RESTful routing](https://book.cakephp.org/4/en/development/routing.html#restful-routing) documentation for handling advanced routing scenarios not covered by this plugin.

Read more at [MixerAPI.com](https://mixerapi.com).

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

[](#installation)

!!! info "" You can skip this step if MixerAPI is installed.

```
composer require mixerapi/rest
bin/cake plugin load MixerApi/Rest
```

Alternatively after composer installing you can manually load the plugin in your Application:

```
# src/Application.php
public function bootstrap(): void
{
    // other logic...
    $this->addPlugin('MixerApi/Rest');
}
```

AutoRouter
----------

[](#autorouter)

Creating routes is already pretty easy, but AutoRouter makes building CRUD routes effortless. This is great if you are just getting started with building APIs in CakePHP.

In your `routes.php` simply add `\MixerApi\Rest\Lib\AutoRouter`:

```
# config/routes.php
$routes->scope('/', function (RouteBuilder $builder) {
    // ... other routes
    (new AutoRouter($builder))->buildResources();
    // ... other routes
});
```

This will add routes for CRUD controller actions (index, add, edit, view, and delete). If your controller does not have any CRUD methods, then the route will be skipped. AutoRouting works for plugins too:

```
# in your plugins/{PluginName}/routes.php file
(new AutoRouter($builder, new ResourceScanner('MyPlugin\Controller')))->buildResources();
```

Create Routes
-------------

[](#create-routes)

While AutoRouter makes life easy, it must scan your controllers to build RESTful resources. This has a slight performance penalty. No worry, you can use `mixerapi:rest route create` to code your routes for you. This will write routes directly to your routes.php file.

```
# writes to `config/routes.php`
bin/cake mixerapi:rest route create
```

Use `--prefix` to specify a prefix:

```
bin/cake mixerapi:rest route create --prefix /api
```

Use `--plugin` for plugins:

```
# writes to `plugins/MyPlugin/config/routes.php`
bin/cake mixerapi:rest route create --plugin MyPlugin
```

To perform a dry-run use the `--display` option:

```
bin/cake mixerapi:rest route create --display
```

For non-CRUD routes, sub-resources, and advanced routing please reference the CakePHP [RESTful routing](https://book.cakephp.org/4/en/development/routing.html#restful-routing) documentation

### List Routes

[](#list-routes)

This works similar to `bin/cake routes` but shows only RESTful routes and improves some formatting of information.

```
bin/cake mixerapi:rest route list
```

To limit output to a specific plugin use the `--plugin` option:

```
# limit to a plugin:
bin/cake mixerapi:rest route list --plugin MyPlugin

#limit to main application:
bin/cake mixerapi:rest route list --plugin App
```

### CRUD HTTP Status Codes

[](#crud-http-status-codes)

The default status codes are:

ActionStatus Codeindex200view200add201edit200delete204To change these load a `MixerApi.Rest.crud.statusCodes` configuration:

```
return [
    'MixerApi' => [
        'Rest' => [
            'crud' => [
                'statusCodes' => [
                    'index' => 200,
                    'view' => 200,
                    'add' => 201,
                    'edit' => 200,
                    'delete' => 204
                ]
            ]
        ]
    ]
];
```

See the CakePHP documentation on [loading configuration files](https://book.cakephp.org/4/en/development/configuration.html#loading-additional-configuration-files)

###  Health Score

37

—

LowBetter than 83% of packages

Maintenance46

Moderate activity, may be stable

Popularity8

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity71

Established project with proven stability

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

Recently: every ~0 days

Total

30

Last Release

1444d ago

Major Versions

v0.3.0 → v1.0.12022-01-16

v1.1.7 → v2.0.02022-06-04

PHP version history (2 changes)v0.1.0PHP &gt;=7.2

v1.0.1PHP ^8.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/171294?v=4)[Chris Nizzardini](/maintainers/cnizzardini)[@cnizzardini](https://github.com/cnizzardini)

---

Top Contributors

[![cnizzardini](https://avatars.githubusercontent.com/u/171294?v=4)](https://github.com/cnizzardini "cnizzardini (17 commits)")

---

Tags

cakephpcakephp-apicakephp-bakecakephp-plugincakephp-restcakephp4phprestrest-apirestfulrestful-apiCakePHP Restcakephp4 restcakephp rest bake

### Embed Badge

![Health badge](/badges/mixerapi-cakephp-rest/health.svg)

```
[![Health](https://phpackages.com/badges/mixerapi-cakephp-rest/health.svg)](https://phpackages.com/packages/mixerapi-cakephp-rest)
```

###  Alternatives

[knuckleswtf/scribe

Generate API documentation for humans from your Laravel codebase.✍

2.3k12.2M45](/packages/knuckleswtf-scribe)[dedoc/scramble

Automatic generation of API documentation for Laravel applications.

2.0k7.8M57](/packages/dedoc-scramble)[phpdocumentor/phpdocumentor

Documentation Generator for PHP

4.4k3.1M878](/packages/phpdocumentor-phpdocumentor)[cakephp/bake

Bake plugin for CakePHP

11211.2M158](/packages/cakephp-bake)[jane-php/jane-php

All jane libraries into one repository

678254.7k4](/packages/jane-php-jane-php)[dereuromark/cakephp-ide-helper

CakePHP IdeHelper Plugin to improve auto-completion

1862.1M27](/packages/dereuromark-cakephp-ide-helper)

PHPackages © 2026

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