PHPackages                             devfactory/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. [HTTP &amp; Networking](/categories/http)
4. /
5. devfactory/api

ActiveLibrary[HTTP &amp; Networking](/categories/http)

devfactory/api
==============

RESTful API package

1.0.5(10y ago)1604[1 issues](https://github.com/DevFactoryCH/api/issues)MITPHPPHP &gt;=5.4.0

Since Dec 8Pushed 10y ago4 watchersCompare

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

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

Api
===

[](#api)

Helpers to create an API for laravel 4.2

This module handle `json` and `xml` as response

[![Latest Stable Version](https://camo.githubusercontent.com/35d41f17a601c68d47114ddb71346a3a757475e9e303b4341676442313e5ca98/68747470733a2f2f706f7365722e707567782e6f72672f646576666163746f72792f6170692f762f737461626c652e737667)](https://packagist.org/packages/devfactory/api)[![Total Downloads](https://camo.githubusercontent.com/a7235ac407e93387b48897e181e14d99adcccd55ce7c43dd92923d55a92e1731/68747470733a2f2f706f7365722e707567782e6f72672f646576666163746f72792f6170692f646f776e6c6f6164732e737667)](https://packagist.org/packages/devfactory/api)[![License](https://camo.githubusercontent.com/a38831115cb7bdeb64c1f6cae228be84de11ed00160c6e1d15c0faac0c9ba561/68747470733a2f2f706f7365722e707567782e6f72672f646576666163746f72792f6170692f6c6963656e73652e737667)](https://packagist.org/packages/devfactory/api)

\##How to setup

update `composer.json` file:

```
{
    "require": {
        "devfactory/api": "1.0.*"
    }
}
```

and run `composer update` from terminal to download files.

update `app.php` file in `app/config` directory:

```
'providers' => array(
  'Devfactory\Api\ApiServiceProvider',
),
```

```
alias => array(
    'API'          => 'Devfactory\Api\Facades\ApiFacade',
),
```

\##Configuration

```
 php artisan config:publish devfactory/api

```

\##How to use api in your route

the param `{format}` are not mandatory

```
Route::group(array('prefix' => 'v1'), function()
{
    Route::get('foo.{format}', 'ApiV1\FooController@foo');
    Route::post('bar.{format}', 'ApiV1\FooController@bar');
});

Route::group(array('prefix' => '{format}/v1'), function()
{
    Route::get('foo', 'ApiV1\FooController@foo');
    Route::post('bar', 'ApiV1\FooController@bar');
});
```

In you controller you can use

```
  return Response::api(array("foo" => "bar"), 404);
  return Response::api(array("ok"));
```

or

```
  return API::createResponse(array("foo" => "bar"), 404);
  return API::createResponse(array("ok"));
```

\##To call your service you can use the Facade

```
  API::get('v1/foo.json', array('foo' => 'bar'));
  API::post('v1/bar.xml', array('foo' => 'bar'));
  API::put('v1/bar.xml', array('foo' => 'bar'));
```

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance0

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 50% 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 ~91 days

Recently: every ~114 days

Total

6

Last Release

3722d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/51b27ef81332de9328fd9d6c4e10156c73c33e86bd63e337eae3bb4985a956ff?d=identicon)[devfactory](/maintainers/devfactory)

---

Top Contributors

[![markcameron](https://avatars.githubusercontent.com/u/1106894?v=4)](https://github.com/markcameron "markcameron (1 commits)")[![sirsquall](https://avatars.githubusercontent.com/u/765946?v=4)](https://github.com/sirsquall "sirsquall (1 commits)")

---

Tags

apilaravelrestrestfulLaravel 4

### Embed Badge

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

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

###  Alternatives

[api-platform/laravel

API Platform support for Laravel

59126.4k6](/packages/api-platform-laravel)[illuminatech/data-provider

Allows easy build for DB queries from API requests

4413.3k](/packages/illuminatech-data-provider)[guanguans/laravel-api-response

Normalize and standardize Laravel API response data structure. - 规范化和标准化 Laravel API 响应数据结构。

485.6k](/packages/guanguans-laravel-api-response)[laragear/api-manager

Manage multiple REST servers to make requests in few lines and fluently.

161.8k](/packages/laragear-api-manager)

PHPackages © 2026

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