PHPackages                             jasonc/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. jasonc/api

ActiveLibrary

jasonc/api
==========

5.0.8(3y ago)1693↓100%1MITPHPPHP &gt;=7.4.0|&gt;=8.0

Since Jan 13Pushed 2y ago1 watchersCompare

[ Source](https://github.com/cjango/laravel-api)[ Packagist](https://packagist.org/packages/jasonc/api)[ RSS](/packages/jasonc-api/feed)WikiDiscussions sanctum Synced today

READMEChangelog (10)Dependencies (4)Versions (43)Used By (0)

LaravelAPI
==========

[](#laravelapi)

[![StyleCi](https://camo.githubusercontent.com/e0cd49320a80023a6d88adeadfa2258915013c3de99732541091bb8c439c486d/68747470733a2f2f6769746875622e7374796c6563692e696f2f7265706f732f3233333530383934312f736869656c643f6272616e63683d73616e6374756d267374796c653d666c6174)](https://camo.githubusercontent.com/e0cd49320a80023a6d88adeadfa2258915013c3de99732541091bb8c439c486d/68747470733a2f2f6769746875622e7374796c6563692e696f2f7265706f732f3233333530383934312f736869656c643f6272616e63683d73616e6374756d267374796c653d666c6174)[![License](https://camo.githubusercontent.com/dcc8ff03d2e515df41cb59a7a0bf879c61f0d2517965c07ec8e270c35df96981/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6a61736f6e632f6170692e737667)](LICENSE)[![Development Version](https://camo.githubusercontent.com/ceef45608fef451a54c2e8f54eb3bdfa052ad910ecddba90389d02ab21ab95e4/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f767072652f6a61736f6e632f6170692e737667)](https://packagist.org/packages/jasonc/api)[![Monthly Installs](https://camo.githubusercontent.com/40aa01d2747933b4c781980e70804e1031f628292ff3f453ce1dc9b634dd41eb/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6a61736f6e632f6170692e737667)](https://packagist.org/packages/jasonc/api)[![PHP](https://camo.githubusercontent.com/b520997e437d3b143e97a9938c9ec88ee1560d7ca695ab3d714c9d57e45047c9/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f6a61736f6e632f6170692e737667)](https://camo.githubusercontent.com/b520997e437d3b143e97a9938c9ec88ee1560d7ca695ab3d714c9d57e45047c9/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f6a61736f6e632f6170692e737667)[![laravel](https://camo.githubusercontent.com/99e2599fcf781f8422224f77b31b2047760d8c59dc56dd2ff47137dbf7020b01/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c61726176656c2d372e302b2d6566336232642e737667)](https://camo.githubusercontent.com/99e2599fcf781f8422224f77b31b2047760d8c59dc56dd2ff47137dbf7020b01/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c61726176656c2d372e302b2d6566336232642e737667)

> 快速构建laravel api服务

1.安装
----

[](#1安装)

```
$ composer require jasonc/api

$ php artisan api:install

$ php artisan vendor:publish
```

2.使用
----

[](#2使用)

```
return $this->message(string $message);
return $this->success(array $data);
return $this->failed(string $error);
```

3.修改 App\\Exceptions\\Handler 文件，引入Trait
----------------------------------------

[](#3修改-appexceptionshandler-文件引入trait)

```
