承接 sabsab43/vcard-fusion 相关项目开发

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

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

sabsab43/vcard-fusion

Composer 安装命令:

composer require sabsab43/vcard-fusion

包简介

This library can merges multiple vcard/vcf files with an occurrences search option.

README 文档

README

This script convert multiple vcard/vcf file sinto one.

You can choose if you want search occurrences or not.

Read this before use the script

Before start convertion, like with any other software, keep a save of your vcards files, especially if you use occurrences search option.

The occurrence search option will compare FN (or N depending on the vcard version) property, if you have two different contacts with same FN or N property, they will be merge.

for example, this two differents vcards with same name (FN property):

BEGIN:VCARD
VERSION:3.0
PRODID:-//dmfs.org//mimedir.vcard//EN
UID:811bd877-a93f-4e76-8098-b61ece5c8650
EMAIL;TYPE=*:john.doe@mail.com
FN:John
REV:20210330T101608Z
TEL;TYPE=VOICE,CELL:+33 1 23 45 67 89
END:VCARD

BEGIN:VCARD
VERSION:3.0
PRODID:-//dmfs.org//mimedir.vcard//EN
UID:811bd877-a93f-4e76-8098-b61ece5c8650
EMAIL;TYPE=*:john.peter@mail.fr
FN:John
REV:20210330T101608Z
TEL;TYPE=VOICE,CELL:+33 9 87 65 43 21
END:VCARD

they will become

BEGIN:VCARD
VERSION:3.0
PRODID:-//dmfs.org//mimedir.vcard//EN
UID:811bd877-a93f-4e76-8098-b61ece5c8650
EMAIL;TYPE=*:john.doe@mail.com
FN:John
REV:20210330T101608Z
TEL;TYPE=VOICE,CELL:+33 1 23 45 67 89
EMAIL;TYPE=*:john.peter@mail.fr
TEL;TYPE=VOICE,CELL:+33 9 87 65 43 21
END:VCARD

So make sure you have different names for your contacts if you don't want this result or disallow checking occurrences option.

Installation

Use composer to get the package

composer require sabsab43/vcard-fusion

It is vailable on Packagist: https://packagist.org/packages/sabsab43/vcard-fusion

Configuration

You just need to put this code in your controller

/** Your autoloader... **/
require('./vendor/autoload.php');

use VcardFusion\VcardManager;

/** Your code .... **/

$errors = [];
if (isset($_FILES) && !empty($_FILES))
{   
    $vcm = new VcardManager($_FILES);
    $errors = $vcm->mergeVcardFiles();  
}

/** Your code...**/

The VcardManager class constructor wait this POST request values

$_POST['version'] //'2.1', '3.0' or '4.0', if not specify return an error
$_POST['checkOccurrences'] // true or false, if not specify set $checkOccurrences to false
$_POST['checkVersion'] //true or false, if not specify set $checkVersion to false

Searching occurrences and checking vcard versions are set by user. You need to specify this options in your form like in this example:

   <form class="form" action="./Your_Controller.php" enctype="multipart/form-data" method="POST">
    
        <fieldset>
            <legend>Vcard version</legend>
            <div>
                <input type="radio" id="vcard2" name="version" value="2.1">
                <label for="vcard2">Vcard 2.1</label>
    
                <input type="radio" id="vcard3" name="version" value="3.0" checked>
                <label for="vcard3">Vcard 3.0</label>
    
                <input type="radio" id="vcard4" name="version" value="4.0">
                <label for="vcard4">Vcard 4.0</label>
            </div>
        </fieldset>

        <fieldset>
            <legend>Options</legend>
            <div>
                <div>
                    <input type="checkbox" name="checkOccurrences" id="checkOccurrences">
                    <label for="checkOccurrences">Check occurrences</label>
                </div>
    
                <div>
                    <input type="checkbox" name="checkVersion" id="checkVersion" checked>
                    <label for="checkVersion">Check files version(<strong>recommended</strong>)</label>
                </div>
            </div>
        </fieldset>

        <fieldset>
            <legend>Select your files</legend>
                <?php if(isset($errors) && !empty($errors)):?>
                    <div>
                        <?php foreach ($errors as $error):
                            echo "<p style='color: red;'>$error</p>";
                        endforeach ?>
                    </div>
                   <?php endif ?>
                <div>
                    <input type="file" accept=".vcf, .vcard" name='files[]' multiple="multiple">
                </div>
        </fieldset>

        <div>
            <button class="btn-custom" type="submit">Merge</button>
        </div>
    </form>

The script will return a new vcard file or print errors if it failed.

统计信息

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

GitHub 信息

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

其他信息

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

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固