SPSS
A PHP library for reading and writing SPSS data files.
Requirements
- PHP 5.3.0 and up.
Installation
The preferred way to install this extension is through composer.
Either run
composer require sakalauskas/spss
or add
"sakalauskas/spss": "^2.0"
to the require section of your composer.json
file.
Usage
Reader example:
$reader = \SPSS\Reader::fromFile('path/to/file.sav');
or
$reader = \SPSS\Reader::fromString(file_get_contents('path/to/file.sav'));
Writer example:
$writer = new \SPSS\Writer([
'header' => [
'prodName' => '@(#) SPSS DATA FILE test',
'layoutCode' => 2,
'compression' => 1,
'weightIndex' => 0,
'bias' => 100,
'creationDate' => '13 Feb 89',
'creationTime' => '13:13:13',
],
'variables' => [
[
'name' => 'VAR1',
'width' => 0,
'decimals' => 0,
'format' => 5,
'columns' => 50,
'align' => 1,
'measure' => 1,
'data' => [
1, 2, 3
],
],
...
]
]);
License
Licensed under the MIT license.