Skip to content
This repository was archived by the owner on Feb 14, 2023. It is now read-only.

Commit b6d246c

Browse files
committed
Update readme with installation, usage and more
1 parent cc12039 commit b6d246c

File tree

1 file changed

+45
-1
lines changed

1 file changed

+45
-1
lines changed

README.md

Lines changed: 45 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,59 @@ Integrate JSON:API resources on Laravel.
66

77
**Note: This package is under active development and initial stage, please DON'T use it for production purposes.**
88

9+
## Installation
10+
11+
You can install the package via composer:
12+
13+
```
14+
composer require skore-labs/laravel-json-api
15+
```
16+
17+
### Usage
18+
19+
As simple as importing the class `SkoreLabs\JsonApi\Http\Resources\JsonApiCollection` for collections or `SkoreLabs\JsonApi\Http\Resources\JsonApiResource` for resources.
20+
21+
```php
22+
<?php
23+
24+
namespace App\Http\Controllers;
25+
26+
use Illuminate\Http\Request;
27+
use SkoreLabs\JsonApi\Http\Resources\JsonApiCollection;
28+
use App\User;
29+
30+
class UserController extends Controller
31+
{
32+
/**
33+
* Display a listing of the resource.
34+
*
35+
* @return \Illuminate\Http\Response
36+
*/
37+
public function index()
38+
{
39+
return new JsonApiCollection(
40+
User::simplePaginate()
41+
);
42+
}
43+
}
44+
```
45+
946
## Features
1047

1148
- Full formatting using pure built-in model methods and properties.
1249
- Relationships and nested working with [eager loading](https://laravel.com/docs/master/eloquent-relationships#eager-loading).
1350
- Permissions "out-of-the-box" authorising each resource view or list of resources.
51+
- Auto-hide not allowed attributes from responses like `user_id` or `post_id`.
1452

1553
## Recommendations
1654

17-
These packages are recommended for a better
55+
These packages are recommended (and suggested by the package installation) for a better integration with JSON:API standards:
1856

1957
- [spatie/laravel-query-builder](https://github.com/spatie/laravel-query-builder)
2058
- [spatie/json-api-paginate](https://github.com/spatie/laravel-json-api-paginate)
59+
60+
## Credits
61+
62+
- Ruben Robles ([@d8vjork](https://github.com/d8vjork))
63+
- Skore ([https://www.getskore.com/](https://www.getskore.com/))
64+
- [And all the contributors](https://github.com/skore-labs/laravel-json-api/graphs/contributors)

0 commit comments

Comments
 (0)