Skip to content

Commit fb2c9de

Browse files
author
Marcel Gwerder
committed
Fixed headings in readme
1 parent 1c794dd commit fb2c9de

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

README.md

100755100644
Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
##Laravel API Handler
1+
## Laravel API Handler
22
[![Build Status](https://travis-ci.org/marcelgwerder/laravel-api-handler.png?branch=master)](https://travis-ci.org/marcelgwerder/laravel-api-handler) [![Latest Stable Version](https://poser.pugx.org/marcelgwerder/laravel-api-handler/v/stable.png)](https://packagist.org/packages/marcelgwerder/laravel-api-handler) [![Total Downloads](https://poser.pugx.org/marcelgwerder/laravel-api-handler/downloads.png)](https://packagist.org/packages/marcelgwerder/laravel-api-handler) [![License](https://poser.pugx.org/marcelgwerder/laravel-api-handler/license.png)](https://packagist.org/packages/marcelgwerder/laravel-api-handler)
33

44
This helper package provides functionality for parsing the URL of a REST-API request.
55

6-
###Installation
6+
### Installation
77

88
***Note:*** This version is for Laravel 5. When using Laravel 4 you need to use version 0.4.x.
99

@@ -28,9 +28,9 @@ Or set an alias in `app.php`:
2828
```
2929
That's it!
3030

31-
###Migrate from 0.3.x to >= 0.4.x
31+
### Migrate from 0.3.x to >= 0.4.x
3232

33-
####Relation annotations
33+
#### Relation annotations
3434

3535
Relation methods now need an `@Relation` annotation to prove that they are relation methods and not any other methods (see issue #11).
3636

@@ -42,7 +42,7 @@ public function author() {
4242
return $this->belongsTo('Author');
4343
}
4444
```
45-
####Custom identification columns
45+
#### Custom identification columns
4646

4747
If you pass an array as the second parameter to `parseSingle`, there now have to be column/value pairs.
4848
This allows us to pass multiple conditions like:
@@ -51,13 +51,13 @@ This allows us to pass multiple conditions like:
5151
ApiHandler::parseSingle($books, array('id_origin' => 'Random Bookstore Ltd', 'id' => 1337));
5252
```
5353

54-
###Configuration
54+
### Configuration
5555

5656
To override the configuration, create a file called `apihandler.php` in the config folder of your app.
5757
Check out the config file in the package source to see what options are available.
5858

5959

60-
###URL parsing
60+
### URL parsing
6161

6262
Url parsing currently supports:
6363
* Limit the fields
@@ -70,7 +70,7 @@ Url parsing currently supports:
7070

7171
There are two kind of api resources supported, a single object and a collection of objects.
7272

73-
####Single object
73+
#### Single object
7474

7575
If you handle a GET request on a resource representing a single object like for example `/api/books/1`, use the `parseSingle` method.
7676

@@ -83,7 +83,7 @@ If you handle a GET request on a resource representing a single object like for
8383
ApiHandler::parseSingle($book, 1);
8484
```
8585

86-
####Collection of objects
86+
#### Collection of objects
8787

8888
If you handle a GET request on a resource representing multiple objects like for example `/api/books`, use the `parseMultiple` method.
8989

@@ -96,7 +96,7 @@ If you handle a GET request on a resource representing multiple objects like for
9696
ApiHandler::parseMultiple($book, array('title', 'isbn', 'description'));
9797
```
9898

99-
####Result
99+
#### Result
100100

101101
Both `parseSingle` and `parseMultiple` return a `Result` object with the following methods available:
102102

@@ -122,7 +122,7 @@ Returns an array of meta provider objects. Each of these objects provide a speci
122122
**cleanup($cleanup) => $this:**
123123
If true, the resulting array will get cleaned up from unintentionally added relations. Defaults to the config `apihandler.cleanup_relations` which defaults to `false`.
124124

125-
####Filtering
125+
#### Filtering
126126
Every query parameter, except the predefined functions `_fields`, `_with`, `_sort`, `_limit`, `_offset`, `_config` and `_q`, is interpreted as a filter. Be sure to remove additional parameters not meant for filtering before passing them to `parseMultiple`.
127127

128128
```
@@ -157,7 +157,7 @@ Respectively the `not-in` suffix:
157157
```
158158

159159

160-
#####Suffixes
160+
##### Suffixes
161161
Suffix | Operator | Meaning
162162
------------- | ------------- | -------------
163163
-lk | LIKE | Same as the SQL `LIKE` operator
@@ -170,13 +170,13 @@ Suffix | Operator | Meaning
170170
-gt | > | Greater than
171171
-not | != | Not equal to
172172

173-
####Sorting
173+
#### Sorting
174174
Two ways of sorting, ascending and descending. Every column which should be sorted descending always starts with a `-`.
175175
```
176176
/api/books?_sort=-title,created_at
177177
```
178178

179-
####Fulltext search
179+
#### Fulltext search
180180
Two implementations of full text search are supported.
181181
You can choose which one to use by changing the `fulltext` option in the config file to either `default` or `native`.
182182

@@ -204,7 +204,7 @@ Each result will also contain a `_score` column which allows you to sort the res
204204

205205
You can adjust the name of this column by modifying the `fulltext_score_column` setting in the config file.
206206

207-
####Limit the result set
207+
#### Limit the result set
208208
To define the maximum amount of datasets in the result, use `_limit`.
209209
```
210210
/api/books?_limit=50
@@ -215,7 +215,7 @@ To define the offset of the datasets in the result, use `_offset`.
215215
```
216216
Be aware that in order to use `offset` you always have to specify a `limit` too. MySQL throws an error for offset definition without a limit.
217217

218-
####Include related models
218+
#### Include related models
219219
The api handler also supports Eloquent relationships. So if you want to get all the books with their authors, just add the authors to the `_with` parameter.
220220
```
221221
/api/books?_with=author
@@ -239,7 +239,7 @@ This is necessary for security reasons, so that only real relation methods can b
239239

240240
***Note:*** Whenever you limit the fields with `_fields` in combination with `_with`. Under the hood the fields are extended with the primary/foreign keys of the relation. Eloquent needs the linking keys to get related models.
241241

242-
####Include meta information
242+
#### Include meta information
243243
It's possible to add additional information to a response. There are currently two types of counts which can be added to the response headers.
244244

245245
The `total-count` which represents the count of all elements of a resource or to be more specific, the count on the originally passed query builder instance.
@@ -256,7 +256,7 @@ Config | Header
256256
meta-total-count | Meta-Total-Count
257257
meta-filter-count | Meta-Filter-Count
258258

259-
####Use an envelope for the response
259+
#### Use an envelope for the response
260260
By default meta data is included in the response header. If you want to have everything togheter in the response body you can request a so called "envelope"
261261
either by including `response-envelope` in the `_config` parameter or by overriding the default `config.php` of the package.
262262

0 commit comments

Comments
 (0)