PHPackages                             khsing/laravel-restapi - 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. khsing/laravel-restapi

ActiveLibrary[API Development](/categories/api)

khsing/laravel-restapi
======================

Quick but dirty setup a RESTful API project with Laravel, be evil! ;-)

v5.5.1(8y ago)23151MITPHP

Since Jul 21Pushed 7y ago1 watchersCompare

[ Source](https://github.com/khsing/laravel-restapi)[ Packagist](https://packagist.org/packages/khsing/laravel-restapi)[ RSS](/packages/khsing-laravel-restapi/feed)WikiDiscussions master Synced today

READMEChangelog (5)Dependencies (5)Versions (6)Used By (0)

laravel-restapi
===============

[](#laravel-restapi)

Intro
-----

[](#intro)

This package make OAuth2.0 client credentials able to assign User.

### Feature

[](#feature)

- client ID support Hashids to encrypt real ID.

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

[](#installation)

- Require this package

```
composer require khsing/laravel-restapi

```

- modify `config/app.php`, add it `providers` with following lines

```
Khsing\Restapi\OAuth2ServiceProvider::class,
Khsing\Restapi\RestapiServiceProvider::class,
```

- execute `php artisan migrate`
- execute `php artisan vendor:publish`
- Need follow [laravel/passport](https://github.com/laravel/passport) setup

Since Laravel 5.5 LTS, passport would specific route register, can custom in `app/Providers/AuthServiceProvider.php`

```
Passport::routes(function ($router) {
    $router->forAccessTokens();
    $router->forTransientTokens();
});
```

Configuare
----------

[](#configuare)

Support following configure options.

- `enable_hashids`, boolean, true/false
- `hashids_salt`, salt of hashids, NEED REPLACE WITH YOURS.
- `hashids_length`, length of hashids
- `hashids_alphabet`, alphabet of hashids

Usage
-----

[](#usage)

- create a client app id and secret.

```
php artisan passport:client
```

fill user id, client name and get client secret.

- Modify `routes/api.php`

```
Route::get('/user', function (Request $request) {
    return $request->user();
})->middleware('auth:api');
```

Now, access `/api/user` will get user's infomation.

btw. Postman is great tools. And the most great part is it's free.

Intergrate with Dingo/api
-------------------------

[](#intergrate-with-dingoapi)

- install dingo/api, `composer require dingo/api:2.0.0-alpha1`
- add dingo to `providers`, `Dingo\Api\Provider\LaravelServiceProvider::class,`
- `php artisan vendor:publish`
- modify `app/Http/Kernel.php` with following lines

```
    protected $middlewareGroups = [
        ...
        'api:auth' => [
            'auth:api',
            'api.auth',
        ],
    ]
```

- modify `config/api.php` auth part

```
    'auth' => [
        'restapi' => \Khsing\Restapi\DingoAuthServiceProvider::class,
    ]
```

- example of dingo/api, in `routes/api.php` same function

```
$api = app('Dingo\Api\Routing\Router');
$api->version('v1', ['middleware' => 'api:auth'], function ($api) {
    $api->get('user', function (Request $request) {
        return $request->user();
    });
});
```

License
-------

[](#license)

This library following MIT License, please keep License file.

Contact
-------

[](#contact)

Guixing:

- Twitter:
- Email: khsing.cn\_\_AT\_\_.gmail.com

###  Health Score

31

—

LowBetter than 66% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity67

Established project with proven stability

 Bus Factor1

Top contributor holds 92.9% 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 ~36 days

Total

5

Last Release

3120d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/40765?v=4)[Guixing Bai](/maintainers/khsing)[@khsing](https://github.com/khsing)

---

Top Contributors

[![khsing](https://avatars.githubusercontent.com/u/40765?v=4)](https://github.com/khsing "khsing (13 commits)")[![telkins](https://avatars.githubusercontent.com/u/53731?v=4)](https://github.com/telkins "telkins (1 commits)")

---

Tags

apilaravelrestful

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/khsing-laravel-restapi/health.svg)

```
[![Health](https://phpackages.com/badges/khsing-laravel-restapi/health.svg)](https://phpackages.com/packages/khsing-laravel-restapi)
```

###  Alternatives

[unopim/unopim

UnoPim Laravel PIM

10.5k2.2k](/packages/unopim-unopim)[statamic/cms

The Statamic CMS Core Package

4.8k3.5M923](/packages/statamic-cms)[darkaonline/l5-swagger

OpenApi or Swagger integration to Laravel

2.9k36.4M126](/packages/darkaonline-l5-swagger)[knuckleswtf/scribe

Generate API documentation for humans from your Laravel codebase.✍

2.3k13.5M60](/packages/knuckleswtf-scribe)[justbetter/laravel-magento-client

A client to interact with Magento

49108.7k14](/packages/justbetter-laravel-magento-client)[scriptdevelop/whatsapp-manager

Paquete para manejo de WhatsApp Business API en Laravel

783.5k](/packages/scriptdevelop-whatsapp-manager)

PHPackages © 2026

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