-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathindex.yml
122 lines (115 loc) · 4.07 KB
/
index.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
title: 'Laravel Rest Api - Generate API in seconds'
description: Generate powerful and secured API using Laravel Rest Api. Designed to streamline your web application development and save you time.
navigation: false
hero:
title: 'Generate API in seconds.'
description: 'Fully integrated with Laravel, take the advantage of a powerful API without destructuring your codebase.'
orientation: horizontal
links:
- label: Get started
icon: i-heroicons-arrow-right-20-solid
trailing: true
to: '/getting-started/installation'
size: lg
- label: Star on Github
icon: i-mdi-github
size: lg
color: gray
to: https://github.com/lomkit/laravel-rest-api
target: _blank
code: |
```bash [Terminal]
composer require lomkit/laravel-rest-api
php artisan rest:quick-start
```
features:
title: 'Start your next project with a powerful API'
items:
- title: 'Laravel built-in'
description: 'Fully integrates with Laravel (Gates / relationships / ...)'
icon: 'i-mdi-laravel'
- title: 'Customizable'
description: 'Benefit the power of full customization for your needs.'
icon: 'i-mdi-cog-outline'
- title: 'Powerful'
description: 'The search operation gives your API consumers a lot of possibilities.'
icon: 'i-mdi-flash-outline'
- title: 'Secured'
description: 'Control what your API exposes and avoid unwanted actions.'
icon: 'i-mdi-lock-outline'
- title: 'Documentation'
description: 'Automatic documentation generation with a single command.'
icon: 'i-mdi-file-document-box-multiple-outline'
- title: 'Reduce API calls'
description: 'The mutate endpoints allows you to operate multiple operations in a single call.'
icon: 'i-mdi-call-split'
onboardings:
- title: 'First, define your resource'
terminal: |
```bash [Terminal]
php artisan rest:resource UserResource
```
links:
- label: 'Configure your resource'
trailingIcon: 'i-heroicons-arrow-right-20-solid'
color: 'gray'
to: '/resources/basics'
size: lg
code: |
```php [UserResource.php]
<?php
namespace App\Rest\Resources;
use App\Rest\Resource;
class UserResource extends Resource
{
/**
* The model the resource corresponds to.
*
* @var class-string<\Illuminate\Database\Eloquent\Model>
*/
public static $model = \App\Models\User::class;
}
```
- title: 'After, create your controller'
terminal: |
```bash [Terminal]
php artisan rest:controller UsersController
```
code: |
```php [UsersController.php]
<?php
namespace App\Rest\Controllers;
use App\Rest\Controller;
class UsersController extends Controller
{
/**
* Fully-qualified resource class name
*/
public static $resource = App\Resources\UserResource::class;
}
```
- title: 'Finally, register the routes'
terminal: |
```php [api.php]
use \Lomkit\Rest\Facades\Rest;
Rest::resource('users', \App\Rest\Controllers\UsersController::class)
```
code: |
```bash
+--------+----------------------------+-------------------+
| Method | URI | Name |
+--------+----------------------------+-------------------+
| GET | api/users | api.users.details |
| POST | api/users/search | api.users.search |
| POST | api/users/actions/{action} | api.users.operate |
| POST | api/users/mutate | api.users.mutate |
| DELETE | api/users | api.users.destroy |
+--------+----------------------------+-------------------+
```
quickstart:
title: 'Or use our <span class="text-primary-400">Quick Start</span>'
description: 'It generated all the files listed above automatically !'
code: |
```bash [Terminal]
php artisan rest:quick-start
```