arrounded/extractors

此包已被废弃,不再维护。没有建议的替代包。

用于从各种来源提取数据的抽象层

dev-master 2015-06-21 19:48 UTC

This package is auto-updated.

Last update: 2019-11-15 14:46:48 UTC


README

Build Status Latest Stable Version Total Downloads Scrutinizer Quality Score Code Coverage

安装

通过Composer

$ composer require arrounded/extractors

用法

想法是扩展现有的提取器,这些提取器提供最小功能,并根据您的用例进行修改。

例如(使用CsvExtractor

class MyExtractor extends CsvExtractor {

   public function getData(array $data = [])
   {
        // $data contains the entire content of a row in the CSV

        // You can return whatever you need from the row.
        return $data;
   }
}

// Using the extractor

$extractor = new MyExtractor();
$extractor->setFixture('path/to/data.csv');
$extractor->run(function ($data) {
    // $data contains whatever is the output of `MyExtractor::getData()`.

    // Persist in database
});

测试

$ composer test

许可证

MIT许可证(MIT)。请参阅许可证文件获取更多信息。