PHPackages                             collecthor/spss - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [CLI &amp; Console](/categories/cli)
4. /
5. collecthor/spss

ActiveLibrary[CLI &amp; Console](/categories/cli)

collecthor/spss
===============

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

v3.1.1(4y ago)023.6kMITPHPPHP &gt;=8.0

Since Mar 7Pushed 4y agoCompare

[ Source](https://github.com/collecthor/spss)[ Packagist](https://packagist.org/packages/collecthor/spss)[ RSS](/packages/collecthor-spss/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (5)Versions (18)Used By (0)

SPSS / PSPP
===========

[](#spss--pspp)

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](CHANGELOG.md))

[![Build Status](https://camo.githubusercontent.com/088e65a6207627dcecc7e6fd5219c065c95947f4e694681d87528f23344a23ac/68747470733a2f2f7472617669732d63692e636f6d2f636f6c6c656374686f722f737073732e7376673f6272616e63683d6d6173746572)](https://travis-ci.com/collecthor/spss)[![Latest Stable Version](https://camo.githubusercontent.com/1bff748936f7214e807373c2e1f21995dd24cfa10a5898551fe8eb6cbcea2255/68747470733a2f2f706f7365722e707567782e6f72672f636f6c6c656374686f722f737073732f762f737461626c65)](https://packagist.org/packages/collecthor/spss)[![Total Downloads](https://camo.githubusercontent.com/6c684d57d6d2aab5db7990eb134e9a72add50b84c07266b2b82790ffad9b42d6/68747470733a2f2f706f7365722e707567782e6f72672f636f6c6c656374686f722f737073732f646f776e6c6f616473)](https://packagist.org/packages/collecthor/spss)[![Latest Unstable Version](https://camo.githubusercontent.com/7b49cb383cffc0fca19a2a3f9736e645abe733a1063a9379843305b3827503ca/68747470733a2f2f706f7365722e707567782e6f72672f636f6c6c656374686f722f737073732f762f756e737461626c65)](https://packagist.org/packages/collecthor/spss)[![License](https://camo.githubusercontent.com/51c6763b057728764c4390e66822edcb4c61ae58a92fa32aa2f181e2572a3892/68747470733a2f2f706f7365722e707567782e6f72672f636f6c6c656374686f722f737073732f6c6963656e7365)](https://packagist.org/packages/collecthor/spss)[![Code Coverage](https://camo.githubusercontent.com/61eb2f8d403a9df6acb9df108690c2d70061d46497751fc5d8d1411def1875e1/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f636f6c6c656374686f722f737073732f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/collecthor/spss/?branch=master)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/9faf034ff8c8febf4f1a5f6185c7d38da21f5d815f6c658241ee03fb1bb0a357/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f636f6c6c656374686f722f737073732f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/collecthor/spss/?branch=master)

Plans
=====

[](#plans)

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

Requirements
------------

[](#requirements)

- PHP 7.3.0 and up (this fork will not support PHP versions that do not have [active support](https://www.php.net/supported-versions.php))
- mbstring extension
- bcmath extension

Installation
------------

[](#installation)

The preferred way to install this extension is through [composer](http://getcomposer.org/download/).

Either run

```
composer require collecthor/spss

```

or add

```
"tiamo/spss": "*"

```

to the require section of your `composer.json` [file](https://packagist.org/packages/tiamo/spss)or download from [here](https://github.com/tiamo/spss/releases).

Usage
-----

[](#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
---------

[](#changelog)

Please have a look in [CHANGELOG](CHANGELOG.md)

License
-------

[](#license)

Licensed under the [MIT license](http://opensource.org/licenses/MIT).

###  Health Score

38

—

LowBetter than 85% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity26

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity77

Established project with proven stability

 Bus Factor1

Top contributor holds 73.8% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~114 days

Recently: every ~92 days

Total

16

Last Release

1642d ago

Major Versions

2.2.2 → 3.0.02020-11-13

PHP version history (5 changes)2.0.0PHP &gt;=5.3.0

2.1.0PHP &gt;=5.5

2.1.6PHP &gt;=7.3

3.0.0PHP &gt;=7.4

v3.1.0PHP &gt;=8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/18b13c534e3812b66a72645fe215301b54fc4d288f6396fee9385b681e27da18?d=identicon)[SamMousa](/maintainers/SamMousa)

---

Top Contributors

[![tiamo](https://avatars.githubusercontent.com/u/1963342?v=4)](https://github.com/tiamo "tiamo (79 commits)")[![SamMousa](https://avatars.githubusercontent.com/u/547021?v=4)](https://github.com/SamMousa "SamMousa (14 commits)")[![mennodekker](https://avatars.githubusercontent.com/u/922643?v=4)](https://github.com/mennodekker "mennodekker (12 commits)")[![blp](https://avatars.githubusercontent.com/u/613451?v=4)](https://github.com/blp "blp (1 commits)")[![pcholewasw](https://avatars.githubusercontent.com/u/79566577?v=4)](https://github.com/pcholewasw "pcholewasw (1 commits)")

---

Tags

cliwriterreaderstatisticsdatasetcli-appibmspssporsavpspp

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/collecthor-spss/health.svg)

```
[![Health](https://phpackages.com/badges/collecthor-spss/health.svg)](https://phpackages.com/packages/collecthor-spss)
```

###  Alternatives

[tiamo/spss

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

78294.6k2](/packages/tiamo-spss)[flobee/spss

SPSS is a php-based implementation of IBM SPSS Statistics Standard. (Read/write SPSS, PSPP .sav files)

1119.7k1](/packages/flobee-spss)[symfony/console

Eases the creation of beautiful and testable command line interfaces

9.8k1.1B11.3k](/packages/symfony-console)[nunomaduro/collision

Cli error handling for console/command-line PHP applications.

4.6k331.8M8.5k](/packages/nunomaduro-collision)[nunomaduro/termwind

It's like Tailwind CSS, but for the console.

2.5k239.8M286](/packages/nunomaduro-termwind)[wp-cli/wp-cli

WP-CLI framework

5.1k17.2M320](/packages/wp-cli-wp-cli)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
