-
Notifications
You must be signed in to change notification settings - Fork 0
/
usage.php
44 lines (35 loc) · 1.45 KB
/
usage.php
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
<?php
include "vendor/autoload.php";
use WarrenCA\PhilippineTowns\Parser;
use WarrenCA\PhilippineTowns\IoC;
// // Basic Usage
// // Create IoC for 'parser', you must always call this
// // before using the Parser::getArea()
// IoC::bind('parser', function(){
// return new Parser(new WarrenCA\PhilippineTowns\ParserHook);
// });
// Alternatively use this binding to save parse data to any data store
include "DatabaseHook.php";
IoC::bind('parser', function(){
// You can always change DatabaseHook to any class as long as it
// implements WarrenCA\PhilippineTowns\ParserHookInterface
return new Parser(new DatabaseHook);
});
// Will only return list of regions
// look for build/regions-only.json
$regions = Parser::getArea("Regions");
// // Will only return list of provinces
// // look for build/provinces-only.json
// $provinces = Parser::getArea("Provinces");
// // Will only return list of municipalities
// // look for build/municipalities-only.json
// $municipalities = Parser::getArea("Municipalities");
// // Will return list of regions
// // look for build/regions-all.json
// $regions = Parser::getArea("Regions")->all();
// // Will return list of provinces with respective region
// // look for build/provinces-all.json
// $provinces = Parser::getArea("Provinces")->all();
// // Will return list of municipalities with respective province and region
// // look for build/municipalities-all.json
// $municipalities = Parser::getArea("Municipalities")->all();