PHP code example of gdpeter / tp6-addons

1. Go to this page and download the library: Download gdpeter/tp6-addons library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

gdpeter / tp6-addons example snippets


return [
    'type'=>[ //这个是分组,package.xml配置里面可以配置type
        'system'=>[ //系统包
            'dep'=>0, //深度 0表示这个目录就是一个项目
            'path'=> root_path()
        ],
//        'addons'=>[ //插件包
//            'dep'=>1, // 1表示这个目录里面有多个项目
//            'path'=> root_path() . 'addons/'
//        ],
        'debug'=>env('app.debug', false), //debug模式不开启缓存
        'burst'=>4048*1024, //补丁下载分包大小
        'sql_from_pre' => 'tp6_', //数据库替换前缀
        //...详细配置请查看Gdpeter\Tp6Addons\Service服务注入的$defaultConfig
    ],
]

<?xml version="1.0" encoding="utf-8"

<?xml version="1.0" encoding="utf-8"

//注意这里的system是包名identifie不是分组type,例如你是dep为1的type为addons中有一个插件名为coupon,这里是coupon而非addons
$res = app(Package::class)->installPackage('system','1.0.1','http://xxx/1.0.1.zip','md5xxxxxxx');

if($res){
    $this->success('升级成功');
}else{
    $this->error('升级进程正在进行中!');
}