PHPackages                             cloudmonitor/apiflow - 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. cloudmonitor/apiflow

AbandonedArchivedLibrary[API Development](/categories/api)

cloudmonitor/apiflow
====================

Shortcut your RESTful API.

v1.1.41(3y ago)0412MITPHPPHP ^8.0

Since Sep 1Pushed 3y ago1 watchersCompare

[ Source](https://github.com/CloudMonitorApp/APIFlow)[ Packagist](https://packagist.org/packages/cloudmonitor/apiflow)[ RSS](/packages/cloudmonitor-apiflow/feed)WikiDiscussions main Synced today

READMEChangelog (10)Dependencies (1)Versions (26)Used By (0)

Develop RESTful API endpoints fast with rich features such as keyword querying, pagination, etc.

### Install

[](#install)

```
composer require cloudmonitor/apiflow
```

### Prepare controllers

[](#prepare-controllers)

Similar to special attributes in Eloquent, such as $fillables, APIFlow allows for custom attributes defined as arrays. This way you can control how your data is exposed through your API.

#### Methods

[](#methods)

Currently APIFlow is intended for RESTful resource listings, that be `index` or collections and single entries `show`. It can either be done by specifically referering to a API resource and an Eloquent model:

```
class UserController extends APIController
{
  public function index()
  {
    return parent::api(\App\Http\Resources\User::class, \App\Models\User::class)->many();
  }
}
```

Or, if as above, the names are following the standard convention, that is App\\Http\\Controllers\\**User**Controller, \\App\\Http\\Resources\\User and \\App\\Models\\User:

```
class UserController extends APIController
{
  public function index()
  {
    return parent::api()->many();
  }
}
```

Likewise you may display a single record.

```
class UserController extends APIController
{
  public function show($id)
  {
    return parent::api()->one($id);
  }
}
```

Shortcuts available are also:

- `->getIndex()`
- `->getShow($id)`

#### Apply extra queries

[](#apply-extra-queries)

`apply()` can be used to apply extra filters, such IDs below 10.

```
class UserController extends APIController
{
  public function index()
  {
    return parent::api()
      ->apply(function(Builder $q) {
        return $q->where('id', '
