forked from tufanbarisyildirim/php-apk-parser
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApkParser.php
More file actions
76 lines (70 loc) · 1.83 KB
/
ApkParser.php
File metadata and controls
76 lines (70 loc) · 1.83 KB
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
<?php
include_once dirname(__FILE__) . "/lib/ApkArchive.php";
include_once dirname(__FILE__) . "/lib/ApkXmlParser.php";
include_once dirname(__FILE__) . "/lib/ApkManifest.php";
/**
* @author Tufan Baris YILDIRIM
* @version v0.1
* @since 27.03.2012
* @link https://github.com/tufanbarisyildirim/php-apk-parser
*
* Main Class.
* - Set the apk path on construction,
* - Get the Manifest object.
* - Print the Manifest XML.
*
* @todo Add getPackageName();
* @todo Add getVersion();
* @todo Add getUsesSdk();
* @todo Add getMinSdk();
*/
class ApkParser
{
/**
* @var ApkArchive
*/
private $apk;
/**
* AndrodiManifest.xml
*
* @var ApkManifest
*/
private $manifest;
public function __construct($apkFile)
{
$this->apk = new ApkArchive($apkFile);
$this->manifest = new ApkManifest(new ApkXmlParser($this->apk->getManifestStream()));
}
/**
* Get Manifest Object
* @return ApkManifest
*/
public function getManifest()
{
return $this->manifest;
}
/**
* Get the apk. Zip handler.
* - Extract all(or sp. entries) files,
* - add file,
* - recompress
* - and other ZipArchive features.
*
* @return ApkArchive
*/
public function getApkArchive()
{
return $this->apk;
}
/**
* Extract apk content directly
*
* @param mixed $destination
* @param array $entries
* @return bool
*/
public function extractTo($destination,$entries = NULL)
{
return $this->apk->extractTo($destination,$entries);
}
}