承接 bitandblack/folder-watcher 相关项目开发

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

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

bitandblack/folder-watcher

Composer 安装命令:

composer require bitandblack/folder-watcher

包简介

Watches a folder and handles its files. This script is meant to run from your CLI.

README 文档

README

PHP from Packagist Latest Stable Version Total Downloads License

Bit&Black Logo

Bit&Black Folder Watcher

Watches a folder and handles its files. This script is meant to run from your CLI.

It may be used to realise a hotfolder on your local system.

Installation

This library is made for the use with Composer. Add it to your project by running $ composer require bitandblack/folder-watcher.

Usage

Create a new object and tell it the path to the folder you want to watch and a pattern for the files you want to select:

<?php

use BitAndBlack\FolderWatcher\FolderWatcher;

$watcher = new FolderWatcher(
    '/path/to/your/folder',
    '*.txt'
);

Set a callback function to handle the files one after another:

<?php

$watcher->setCallback(static function($file) {    
    echo 'Handling file ' . $file . ' now' . PHP_EOL;
});

Start the watcher:

<?php

$watcher->watch();

Cancel the watcher

Per default the watcher is meant to run forever. You can change this by calling finishOnEmptyFolder(). It's always possible to abort by pressing the keys Ctrl + C. The script will stop after finishing the current task.

Logging

The watcher may give information about the files inside a folder and is able to pass it to the Symfony console. Set the console output object to the watcher with setOutput($consoleOutput).

Help

If you have any questions, feel free to contact us under hello@bitandblack.com.

Further information about Bit&Black can be found under www.bitandblack.com.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-07-01

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固