Skip to content

Parser and format description of Origin project files (OPJ).

License

Notifications You must be signed in to change notification settings

jgonera/openopj

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OpenOPJ

This repository contains a parser of Origin project files (OPJ) written in PHP. It supports reading worksheet data, parameters and notes.

Although there exist other OPJ parsers, OpenOPJ has been written to merge it with an existing PHP project. Additionally, it contains detailed documentation of the supported features of the OPJ format (see docs/opj_format.markdown) and a test suite.

The parser has been developed in the Minor Laboratory at the University of Virginia and is licensed under the MIT license.

How to use

<?php
require_once('openopj/lib/OpenOPJ.php');

use OpenOPJ\OPJFile, OpenOPJ\FileReader, OpenOPJ\StringReader;

// read from file
$opj = new OPJFile(new FileReader('path/file.opj'));
// or read from string (e.g. when stored in DB, fetched from other server)
$opj = new OPJFile(new StringReader($binaryString));

// first row of a column in a worksheet
echo $opj->data['Worksheet_Column'][0];
// parameter
echo $opj->parameters['SOME_NAME'];
// notes, e.g. ResultsLog
echo $opj->notes['ResultsLog'];
?>

Tests

Tests for the supported features are written in PHPUnit 3.6. If you cloned the repository with submodules you can use make test to run them with an RSpec-like result printer. Otherwise, just run phpunit in the repository directory.

For debugging purposes you can run the tests with an STDERR logger with LOG=1 make test or LOG=1 phpunit.

About

Parser and format description of Origin project files (OPJ).

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages