承接 csesumonpro/phpzipmaker 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

csesumonpro/phpzipmaker

最新稳定版本:v1.0.5

Composer 安装命令:

composer require csesumonpro/phpzipmaker

包简介

Php zip maker is a simple archive generator composer package. This package can make an archive with selected files & folders and deselect files & folders. This package also provides facilities to set the archive name, extension, and directory where you want to generate the archive.

README 文档

README

Total Downloads License Latest Stable Version

PHP Zip Maker

Php zip maker is a simple library to create archive for your project with the selected file or folder.

Installation

Install the package through Composer.

For PHP 5.6 or 5.6~: composer require csesumonpro/phpzipmaker

Note: If your project doesn't have any composer.json file, you can use it by downloading the zip file from the github repository.

Configuration

Just need to set an .xml file in your project root with the following code: and the name must be phpzipmaker.xml

<?xml version="1.0"?>
<ruleset name="Php Zip Maker">
    <archiveName>phpzipmaker</archiveName>
    <archiveExtension>.zip</archiveExtension>
    <archiveFormDirectory>/Volumes/Projects/plugins/phpzipmaker</archiveFormDirectory>
    <archiveToDirectory>/Users/csesumonpro/desktop</archiveToDirectory>

    <include-file>
        <include>index.php</include>
        <include>config.php</include>
    </include-file>

    <exclude-file>
        <exclude>app/Controllers/HomeController.php</exclude>
    </exclude-file>

    <include-directory>
        <include>app</include>
        <include>vendor</include>
    </include-directory>

    <exclude-directory>
        <exclude>app/Models</exclude>
        <exclude>vendor/phpzipmaker</exclude>
    </exclude-directory>

</ruleset>

XML Description

archiveName - The name of the archive file. (optional) It will automatically get the name of your project when you do not provide any name.

archiveExtension - The extension of the archive file. (optional) It will automatically set .zip extension when you do not provide any extension.
Supported Extensions:

['.zip', '.rar', '.tar', '.gz', '.bz2', '.7z']

archiveFormDirectory - The directory of the archive file. (optional) It will automatically get the directory path of your project when you do not provide any directory path.

archiveToDirectory - The directory where the archive file will be saved. (optional) It will automatically get the directory path of your project when you do not provide any directory path.

include-file - The file that you want to include in the archive file. (required)

exclude-file - The file that you want to exclude in the archive file. (optional)

include-directory - The directory that you want to include in the archive file. (optional)

exclude-directory - The directory that you want to exclude in the archive file. (optional)

Usage

It's very easy to make an archive through the above XML config just run the below command from your project root.

php ./vendor/csesumonpro/phpzipmaker/phpzipmaker.php

UseCase

Suppose you have a project with the following structure:

project
├── app
│   ├── Controllers
│   │   └── HomeController.php
│   ├── Models
│   │   └── User.php
│   └── Views
│       └── home.php
├── vendor
│   ├── autoload.php
│   ├── composer
│   │   ├── autoload_classmap.php
│   │   ├── autoload_files.php
│   │   ├── autoload_namespaces.php
│   │   ├── autoload_psr4.php
│   │   ├── autoload_real.php
│   │   ├── autoload_static.php
│   │   ├── ClassLoader.php
│   │   └── installed.json
│   └── phpzipmaker
│       ├── LICENSE
│       ├── README.md
│       ├── composer.json
│       ├── phpzipmaker.php
│       └── src
│           ├── PhpZipMaker.php
|index.php
|config.php

If you want to include a file just use it like this:

<include-file>
    <include>index.php</include>
</include-file>

If you want to include a file from a directory that directory already excluded you can do it

<include-file>
    <include>vendor/phpzipmaker/phpzipmaker.php</include>
</include-file>

if you want to include a directory which directory have many other files and directory

<include-directory>
    <include>app</include>
</include-directory>

if you want to exclude a file from an included directory you can do it

<exclude-file>
    <exclude>app/Controllers/HomeController.php</exclude>
</exclude-file>

If you want to exclude a directory that directory already included you can do it

<exclude-directory>
    <exclude>app/Models</exclude>
</exclude-directory>

Reference

Packagist || Github

License

The php zip maker is an open-sourced software licensed under the MIT license

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-09-04