定制 niisan-tokyo/web-clamav-php 二次开发

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

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

niisan-tokyo/web-clamav-php

最新稳定版本:v0.3.0

Composer 安装命令:

composer require niisan-tokyo/web-clamav-php

包简介

Anti virus scanner through web using php with clamav.

README 文档

README

We can use clamav scan through remote network by this library.

Before using this library, we prepare a remote clamav server. For example, we can use a clamav container following:

docker run -d dinkel/clamavd

Usage

Execute following code.

require 'vendor/autoload.php';

$scanner = \Niisan\ClamAV\ScannerFactory::create([
    'driver' => 'remote',
    'url' => 'example.com'
]);

if (! $scanner->scan($_FILE['userfile']['tmp_name'])) {
    echo 'User file has a virus!';
}

If a file have some virus, Scanner::scan return false.

config

When you want know a config that is an argument of ScannerFactory, See example.config.php.

You can select driver, which 'remote' or 'local'. When yor select 'remote', the config need 'host' or 'remote.host' that means clamd host: following

[
    'driver' => 'remote',
    'url' => 'examle.com'
];
[
    'driver' => 'remote'
    'remote' => [
        'host' => 'example.com'
    ]
];

Or you select 'local', the config need 'path' or 'local.path', that means a unix socket of clamd.

[
    'driver' => 'local',
    'path' => '/var/run/clamav/clamd.ctl'
]

for developing

If you want to develop this package, some tests will fail for not starting clamd server. So you command clamd start to start clamav daemon before testing.

统计信息

  • 总下载量: 49.27k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 10
  • 点击次数: 1
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-07-26