定制 collecthor/spss 二次开发

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

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

collecthor/spss

Composer 安装命令:

composer require collecthor/spss

包简介

SPSS is a php-based implementation of IBM SPSS Statistics Standard

README 文档

README

A PHP library for reading and writing SPSS / PSPP .sav data files. This library was forked from tiamo/spss since the original is not seeing a lot of activity.

VERSION 2.1.0 (CHANGELOG)

Build Status Latest Stable Version Total Downloads Latest Unstable Version License Code Coverage Scrutinizer Code Quality

Plans

The plan is, in time, to fully rewrite this library to allow for streaming large datasets.

Requirements

  • PHP 7.3.0 and up (this fork will not support PHP versions that do not have active support)
  • mbstring extension
  • bcmath extension

Installation

The preferred way to install this extension is through composer.

Either run

composer require collecthor/spss

or add

"tiamo/spss": "*"

to the require section of your composer.json file or download from here.

Usage

Reader example:

// Initialize reader
$reader = \collecthor\spss\Reader::fromFile('path/to/file.sav');

// Read header data
$reader->readHeader();
// var_dump($reader->header);

// Read full data
$reader->read();
// var_dump($reader->variables);
// var_dump($reader->valueLabels);
// var_dump($reader->documents);
// var_dump($reader->data);

or

$reader = \collecthor\spss\Reader::fromString(file_get_contents('path/to/file.sav'))->read();

Writer example:

$writer = new \collecthor\spss\Writer([
    'header' => [
            'prodName'     => '@(#) SPSS DATA FILE test',
            'layoutCode'   => 2,
            'compression'  => 1,
            'weightIndex'  => 0,
            'bias'         => 100,
            'creationDate' => '01 Feb 01',
            'creationTime' => '01:01:01',
    ],
    'variables' => [
        [
                'name'     => 'VAR1', # For UTF-8, 64 / 3 = 21, mb_substr($var1, 0, 21);
                'width'    => 0,
                'decimals' => 0,
                'format'   => 5,
                'columns'  => 50,
                'align'    => 1,
                'measure'  => 1,
                'data'     => [
                    1, 2, 3
                ],
        ],
        ...
    ]
]);

Changelog

Please have a look in CHANGELOG

License

Licensed under the MIT license.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-11-19

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固