PHPackages                             pankaj-ag/larave-mobile-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. pankaj-ag/larave-mobile-mobile-api

ActiveProject[API Development](/categories/api)

pankaj-ag/larave-mobile-mobile-api
==================================

A Laravel package to setup mobile

v1.1(7y ago)181[3 PRs](https://github.com/pankaj-ag/laravel-mobile-api/pulls)MITPHPCI failing

Since Nov 26Pushed 1y agoCompare

[ Source](https://github.com/pankaj-ag/laravel-mobile-api)[ Packagist](https://packagist.org/packages/pankaj-ag/larave-mobile-mobile-api)[ Docs](https://github.com/coloredcow/laravel-gsuite)[ RSS](/packages/pankaj-ag-larave-mobile-mobile-api/feed)WikiDiscussions master Synced today

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

31

↑

LowBetter than 68% of packages

Maintenance33

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity65

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

2700d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/10670690?v=4)[Pankaj Agrawal](/maintainers/pankaj-ag)[@pankaj-ag](https://github.com/pankaj-ag)

---

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/pankaj-ag-larave-mobile-mobile-api/health.svg)

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

###  Alternatives

[stripe/stripe-php

Stripe PHP Library

4.0k143.3M480](/packages/stripe-stripe-php)[twilio/sdk

A PHP wrapper for Twilio's API

1.6k92.9M272](/packages/twilio-sdk)[knplabs/github-api

GitHub API v3 client

2.2k15.8M187](/packages/knplabs-github-api)[facebook/php-business-sdk

PHP SDK for Facebook Business

90121.9M34](/packages/facebook-php-business-sdk)[meilisearch/meilisearch-php

PHP wrapper for the Meilisearch API

73813.7M114](/packages/meilisearch-meilisearch-php)[google/gax

Google API Core for PHP

263103.1M454](/packages/google-gax)

PHPackages © 2026

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