@@ -11,3 +11,137 @@ Install vis composer:
1111-  ` composer require xivapi/xivapi-php ` 
1212
1313## Usage  
14+ 
15+ The ` xivapi-php `  library is a very simple wrapper around Guzzle.
16+ 
17+ ** Initialize** 
18+ ``` php 
19+ $api = new \XIVAPI\XIVAPI();
20+ ``` 
21+ 
22+ ** Setting your key if you have one** 
23+ 
24+ You can set the environment variable: ` XIVAPI_KEY `  Or via:
25+ 
26+ ``` php 
27+ $api->environment->key('my_api_key');
28+ ``` 
29+ 
30+ ** Using global queries** 
31+ 
32+ The following global queries are supported:
33+ 
34+ -  ` columns ` 
35+ 
36+ ``` php 
37+ $columns = [
38+     'ID',
39+     'Name',
40+     'Icon
41+ ];
42+ 
43+ $api->columns($columns)->content->Item()->list();
44+ ``` 
45+ 
46+ -  ` language ` 
47+ 
48+ ``` php 
49+ $api->language('en')->content->Item()->list();
50+ ``` 
51+ 
52+ -  ` snake_case ` 
53+ 
54+ ``` php 
55+ $api->snakeCase()->content->Item()->list();
56+ ``` 
57+ 
58+ -  ` tags ` 
59+ 
60+ ``` php 
61+ $tags = [
62+     'one',
63+     'two',
64+     'three'
65+ ];
66+ $api->tags($tags)->content->Item()->list();
67+ ``` 
68+ 
69+ ### Content  
70+ 
71+ Content is dynamically driven based on what content is available in the game files, thus it has a method method for invoking the different types, eg:
72+ 
73+ -  ` item() ` 
74+ -  ` instanceContent() ` 
75+ -  ` tripleTriadCard() ` 
76+ 
77+ ``` php 
78+ $api->content->[contentName]()->list();
79+ $api->content->[contentName]()->one($id);
80+ 
81+ $api->content->list();
82+ $api->content->servers();
83+ $api->content->serversByDataCenter();
84+ ``` 
85+ 
86+ ### Search  
87+ 
88+ ``` php 
89+ $api->search->find($string)->results();
90+ ``` 
91+ 
92+ The following search modify methods are available:
93+ ``` php 
94+ $api->search->column($column);
95+ $api->search->algorithm($searchStringAlgorithm);
96+ $api->search->page($number);
97+ $api->search->sort($field, $order);
98+ $api->search->limit($limit);
99+ $api->search->columns($columns);
100+ $api->search->bool($bool);
101+ ``` 
102+ 
103+ Filters are additive, multiple can be added, eg:
104+ 
105+ ``` php 
106+ $api->search
107+     ->filter('LevelItem', 30, SearchFilters::GREATER_THAN)
108+     ->filter('ItemSearchCategory', 10, SearchFilters::GREATER_THAN_OR_EQUAL_TO);
109+ ``` 
110+ 
111+ 
112+ ### Character  
113+ 
114+ ``` php 
115+ $api->character->search($name, $server, $page);
116+ $api->character->get($id, $data = [], $extended = false);
117+ $api->character->verify($id);
118+ $api->character->update($id);
119+ $api->character->delete($id);
120+ ``` 
121+ 
122+ ### Free Company  
123+ 
124+ ``` php 
125+ $api->freecompany->search($name, $server, $page);
126+ $api->freecompany->get($id, $data = []);
127+ $api->freecompany->update($id);
128+ $api->freecompany->delete($id);
129+ ``` 
130+ 
131+ ### Linkshell  
132+ 
133+ ``` php 
134+ $api->linkshell->search($name, $server, $page);
135+ $api->linkshell->get($id, $data = []);
136+ $api->linkshell->update($id);
137+ $api->linkshell->delete($id);
138+ ``` 
139+ 
140+ ### PvPTeam  
141+ 
142+ ``` php 
143+ $api->pvpteam->search($name, $server, $page);
144+ $api->pvpteam->get($id, $data = []);
145+ $api->pvpteam->update($id);
146+ $api->pvpteam->delete($id);
147+ ``` 
0 commit comments