Giter Club home page Giter Club logo

spss's Introduction

SPSS / PSPP

A PHP library for reading and writing SPSS / PSPP .sav data files.

VERSION 4.* (see upgrade section for details)

Latest Stable Version Stable Build Status Latest Version on Packagist Total Downloads Latest Unstable Version Unstable Build Status

Fork of tiamo/spss. Mostly same code base. Introdusing a more complete test enviroment which now exists over there. So, one day i switch back to it.

Table of contents

Requirements

PHP 8.0 and up.

  • php-cli
  • php-mdstring
  • php-bcmath

Installation

The preferred way to install this extension is through composer

Either run

composer require flobee/spss

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

Usage

In folder examples/ you will find some more examples.

Reader example:

$reader = \SPSS\Sav\Reader::fromFile('path/to/file.sav')->read();

or

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

Writer example:

$writer = new \SPSS\Sav\Writer([
    'header' => [
            'prodName'     => '@(#) SPSS DATA FILE test',
            'layoutCode'   => 2,
            'compression'  => 1,
            'weightIndex'  => 0,
            'bias'         => 100,
            'creationDate' => '13 Feb 89',
            'creationTime' => '23:58:59',
    ],
    'variables' => [
        [
                'name'     => 'VAR1',
                'width'    => 0,
                'decimals' => 0
                'format'   => 5,
                'columns'  => 50,
                'align'    => 1,
                'measure'  => 1,
                'data'     => [
                    1, 2, 3
                ],
        ],
        ...
    ]
]);
...

Tests / Developers

Install using shell

git clone https://github.com/flobee/spss.git
cd spss/
git submodule init # once
git submodule update --recursive # upgrading (after a `git pull`)

Initialy or for upgrades to get development dependencies:

composer install

For more dev-tools you may install phpstan/phpstan composer require -dev phpstan/phpstan which shows a lot of stucture problems of the application and it should getting more attention (beginning with level=1).

Update existing code

git pull
git submodule update
composer install

Running tests

VERSION 4:
Improved additions for CI systems (e.g: jenkins) where `phing` is the
prefered build tool. `composer` the prefered package manager.

# shows you the options
./phing -l

# executes the tests
./phing test

# executes the tests and create the code coverage
./phing coverage

# run all tasks (CS checks, coverage, tests, sca...)
./phing all

...

cd tests
sh ./runTests.sh

# have a look at ../docs/CodeCoverage (use a browser after execution)
sh ./runTestsCoverageCreate.sh

# playground:
php readerDemo.php | less
# or to update tmp file to check for changes:
php readerDemo.php > data/pspp.sav.printr.txt

Upgrade to version 3.*

Update your composer.json

{
    ...
    "require": {
        "flobee/spss": "3.*",
    },
    ...
}

Next:

composer update flobee/spss

Dependency Errors?

If you get dependency errors, you may upgrade other spss dependencies too. If so try the following:

composer update flobee/spss --with-dependencies

Changelog

Please have a look in docs/CHANGELOG.md

License

Please have a look in License text

spss's People

Contributors

blp avatar breakliu avatar dependabot[bot] avatar flobee avatar lestcape avatar lukepot avatar mennodekker avatar pcholewasw avatar sakalauskas avatar tiamo avatar zupolgec avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.