PHPackages                             coloredcow/laravel-mobile-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. coloredcow/laravel-mobile-api

ActiveProject[API Development](/categories/api)

coloredcow/laravel-mobile-api
=============================

A Laravel package to setup mobile

v1.1(7y ago)16171[2 issues](https://github.com/ColoredCow/laravel-mobile-api/issues)[3 PRs](https://github.com/ColoredCow/laravel-mobile-api/pulls)MITPHPCI failing

Since Nov 26Pushed 1y agoCompare

[ Source](https://github.com/ColoredCow/laravel-mobile-api)[ Packagist](https://packagist.org/packages/coloredcow/laravel-mobile-api)[ Docs](https://github.com/coloredcow/laravel-gsuite)[ RSS](/packages/coloredcow-laravel-mobile-api/feed)WikiDiscussions master Synced 2w ago

READMEChangelog (2)DependenciesVersions (7)Used By (0)

Laravel Mobile API
==================

[](#laravel-mobile-api)

Prerequisite
============

[](#prerequisite)

This package requires a basic understanding of [Laravel Passport](https://laravel.com/docs/5.6/passport).

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

[](#installation)

1. Add this package in your project.
2. Now add the trait `CanHaveAPIEndPoints` in the controller that will contribute in the mobile service. You can also add this trait in the base controller and use it. Now you can use **returnFormattedResponse** method to send the respose. This function will check the request and send the reponse accordingly.

#### Handling web responses only

[](#handling-web-responses-only)

The first argument is the array of data you pass to the view. The second argument is the view name.

```
return $this->returnFormattedResponse(['projects' => $projects], 'project.index');
```

#### Handling both web and API responses

[](#handling-both-web-and-api-responses)

Use two closures for sending different responses for web and api.

```
return $this->returnFormattedResponse(
    function () {
       // api response here
    },

    function () {
       // web response here
    }
);
```

Exception Handling
------------------

[](#exception-handling)

For clear error responses you need to add the trait in the **App\\Exceptions\\Handler** class and add the following code snippt in report method.

```
public function render($request, Exception $exception)
{
    if($this->isApi()) {
        return $this->renderErrorResponseForAPI($exception);
    }
    return parent::render($request, $exception);
}

```

Auth Middleware
---------------

[](#auth-middleware)

If you want to set the auth user for every authenticated route then add `RestApiMiddleware` in your project and apply in on routes.

In kernel.php

```
'restapi' => ColoredCow\LaravelMobileAPI\RestAPIMiddleware::class,
```

In routes/api.php file

```
Route::group(['middleware' => ['auth:api', 'restapi:auth'] ], function () {
    // routes
});
```

###  Health Score

29

—

LowBetter than 57% of packages

Maintenance12

Infrequent updates — may be unmaintained

Popularity17

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity66

Established project with proven stability

 Bus Factor1

Top contributor holds 59.3% 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

2

Last Release

2749d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/3476aa3ca1cb259e58570083bb81d15e6efbf6a94a46fa6ebe706cf1bb4a6138?d=identicon)[coloredcow](/maintainers/coloredcow)

---

Top Contributors

[![pankaj-ag](https://avatars.githubusercontent.com/u/10670690?v=4)](https://github.com/pankaj-ag "pankaj-ag (16 commits)")[![rathorevaibhav](https://avatars.githubusercontent.com/u/12053186?v=4)](https://github.com/rathorevaibhav "rathorevaibhav (6 commits)")[![vikasrinvi](https://avatars.githubusercontent.com/u/32789328?v=4)](https://github.com/vikasrinvi "vikasrinvi (5 commits)")

### Embed Badge

![Health badge](/badges/coloredcow-laravel-mobile-api/health.svg)

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

###  Alternatives

[exsyst/swagger

A php library to manipulate Swagger specifications

35816.3M7](/packages/exsyst-swagger)[hubspot/api-client

Hubspot API client

24015.5M18](/packages/hubspot-api-client)[pocketmine/bedrock-protocol

An implementation of the Minecraft: Bedrock Edition protocol in PHP

172437.8k11](/packages/pocketmine-bedrock-protocol)[botman/driver-telegram

Telegram driver for BotMan

94452.6k6](/packages/botman-driver-telegram)[emartech/emarsys-magento2-extension

Magento2 integration for the Emarsys Marketing Platform

14273.9k](/packages/emartech-emarsys-magento2-extension)

PHPackages © 2026

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