Skip to content

Commit db41ed4

Browse files
authored
Update README.md
1 parent e4532c9 commit db41ed4

File tree

1 file changed

+28
-3
lines changed

1 file changed

+28
-3
lines changed

README.md

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,21 @@
22
<img src="https://raw.githubusercontent.com/kolirt/laravel-api-response/3e46d9c25ba6e7fd096ec57c668125cb2ab985ce/image.svg">
33
</p>
44

5-
# Laravel Api Response
65

6+
# Laravel Api Response
77
The package will help to generate json answers.
88

9-
## Installation
9+
<a href="https://www.buymeacoffee.com/kolirt" target="_blank">
10+
<img src="https://cdn.buymeacoffee.com/buttons/v2/arial-yellow.png" alt="Buy Me A Coffee" style="height: 60px !important;width: 217px !important;" >
11+
</a>
1012

13+
14+
## Installation
1115
```
1216
$ composer require kolirt/laravel-api-response
1317
```
1418

19+
1520
## Example
1621
Error response.
1722
```php
@@ -76,6 +81,7 @@ return api()
7681
]
7782
```
7883

84+
7985
## Methods
8086

8187
### error
@@ -84,18 +90,21 @@ Default response code 400.
8490
return api()->error();
8591
```
8692

93+
8794
### success
8895
Default response code 200.
8996
```php
9097
return api()->success();
9198
```
9299

100+
93101
### setCode
94102
Set custom response code. Available [codes](https://en.wikipedia.org/wiki/List_of_HTTP_status_codes).
95103
```php
96104
return api()->setCode($code);
97105
```
98106

107+
99108
### setDescription
100109
Set description to response.
101110
```php
@@ -104,6 +113,7 @@ return api()->setDescription(['Description #1', 'Description #2']);
104113
return api()->setDescription('Description');
105114
```
106115

116+
107117
### setErrors
108118
Set description to response.
109119
```php
@@ -113,17 +123,20 @@ return api()->setErrors([
113123
]);
114124
```
115125

126+
116127
### abort
117128
```php
118129
return api()->abort('Error message', 400);
119130
```
120131

132+
121133
### cookie
122134
Add cookie to response.
123135
```php
124136
return api()->cookie(cookie('token', 'asdsadsadas', 60 * 3));
125137
```
126138

139+
127140
### setData
128141
Set data to response.
129142
```php
@@ -136,4 +149,16 @@ return api()->setData('Data');
136149
Render response.
137150
```php
138151
return api()->render();
139-
```
152+
```
153+
154+
155+
## FAQ
156+
Check closed [issues](https://github.com/kolirt/laravel-api-response/issues) to get answers for most asked questions
157+
158+
159+
## License
160+
[MIT](LICENSE.txt)
161+
162+
163+
## Other packages
164+
Check out my other packages on my [GitHub profile](https://github.com/kolirt)

0 commit comments

Comments
 (0)