定制 abaydullah/php-laravel-android-apk-parser 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

abaydullah/php-laravel-android-apk-parser

Composer 安装命令:

composer require abaydullah/php-laravel-android-apk-parser

包简介

Read basic info about an application from android .apk file

README 文档

README

This package can extract application package files in APK format used by devices running on Android OS. It can open an APK file and extract the contained manifest file to parse it and retrieve the meta-information it contains like the application name, description, device feature access permission it requires, etc.. The class can also extract the whole files contained in the APK file to a given directory.

Requirements

PHP 8.1+

Installation

Add abaydullah/php-laravel-android-apk-parser as a require dependency in your composer.json file:

$ composer require abaydullah/php-laravel-android-apk-parser

Usage

First create a Scraper instance.

use Abaydullah\ApkParser\Parser;

include 'autoload.php';
$apk = new Parser('APK URL');

$manifest = $apk->getManifest();
$permissions = $manifest->getPermissions();

echo '<pre>';
echo "Package Name      : " . $manifest->getPackageName() . "" . PHP_EOL;
echo "Version           : " . $manifest->getVersionName() . " (" . $manifest->getVersionCode() . ")" . PHP_EOL;
echo "Min Sdk Level     : " . $manifest->getMinSdkLevel() . "" . PHP_EOL;
echo "Min Sdk Platform  : " . $manifest->getMinSdk()->platform . "" . PHP_EOL;
echo "Target Sdk Level     : " . $manifest->getTargetSdkLevel() . "" . PHP_EOL;
echo "Target Sdk Platform  : " . $manifest->getTargetSdk()->platform . "" . PHP_EOL;
echo PHP_EOL;
echo "------------- Permssions List -------------" . PHP_EOL;

// find max length to print more pretty.
$perm_keys = array_keys($permissions);
$perm_key_lengths = array_map(
    function ($perm) {
        return strlen($perm);
    },
    $perm_keys
);
$max_length = max($perm_key_lengths);

foreach ($permissions as $perm => $detail) {
    echo str_pad($perm, $max_length + 4, ' ') . "=> " . $detail['description'] . " " . PHP_EOL;
    echo str_pad(
        '',
        $max_length - 5,
        ' '
    ) . ' cost    =>  ' . ($detail['flags']['cost'] ? 'true' : 'false') . " " . PHP_EOL;
    echo str_pad(
        '',
        $max_length - 5,
        ' '
    ) . ' warning =>  ' . ($detail['flags']['warning'] ? 'true' : 'false') . " " . PHP_EOL;
    echo str_pad(
        '',
        $max_length - 5,
        ' '
    ) . ' danger  =>  ' . ($detail['flags']['danger'] ? 'true' : 'false') . " " . PHP_EOL;
}


echo PHP_EOL;
echo "------------- Activities  -------------" . PHP_EOL;
foreach ($apk->getManifest()->getApplication()->activities as $activity) {
    echo $activity->name . ($activity->isLauncher ? ' (Launcher)' : null) . PHP_EOL;
}

Testing

Tests are powered by PHPUnit. You have several options.

  • Run phpunit if PHPUnit is installed globally.
  • Install dependencies (requires Composer). Run php composer.phar --dev install or composer --dev install. Then bin/vendor/phpunit to run version installed by Composer. This ensures that you are running a version compatible with the test suite.

Thanks

This Package Modified From Here https://github.com/tufanbarisyildirim/php-apk-parser Thanks JetBrains for the free open source license

Jetbrains

License

Apk Parser is MIT licensed.

统计信息

  • 总下载量: 976
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 6
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-11-16

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固