collecthor/spss
最新稳定版本:v3.1.1
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)
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.
统计信息
- 总下载量: 22k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 2
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2019-11-19