Skip to content

SatisfactoryTools/DataUtils

Repository files navigation

SatisfactoryTools/DataUtils

This package can parse exported files from Satisfactory to generate info about recipes, items, schematics, etc.

Running the parser

You need to either have Docker installed, or PHP 8.5+.

For docker, you need to build the container once, and then you can just run it:

docker build -t docs-parser .
docker run --rm docs-parser -v "$PWD:/app" [command]

If you want to use it locally, install dependencies first (requires Composer installed), then run it through PHP:

composer install
php bin/docsParser [command]

Commands

If you run the app without any arguments, it'll show you a list of commands.

You can use help [command] to get info about supported parameters.

Examples

Parse data, export to wiki format, and omit ficsmas data:

php bin/docsParser parse /path/to/docs.json -o /path/to/output/dir -f wiki --no-ficsmas

Using in PHP

If you want to use the parser in your own PHP project, you can add it via composer

composer require SatisfactoryTools/DocsParser

Example usage:

use SFTools\Data\Parser\DocsParser;

$parser = new DocsParser;
$schema = $parser->parse(file_get_contents(__DIR__ . '/docs.json')); // $schema is SFTools\Data\Schema\DocsSchema

// You can also export the schema in any format you like
use SFTools\Data\Export\WikiExporter;

$exporter = new WikiExporter;
$output = $exporter->export($schema);

// $output is either string (file content), or array of [filename => file content] for multiple files

Custom parsing

You can implement SFTools\Data\Export\Exporter interface to define your own format to export. You can also implement SFTools\Data\Transformers\Transformer to add more transformers (they can "fix" wrong datapoints or transform data to different values).

To run a transformer, you can do something like this:

$transformer = new MyTransformer;
$schema = $transformer->transform($schema);

You can also specify a list of handlers/transformers to use in the DocsParser constructor:

$parser = new DocsParser([MyHandler::class], [MyTransformer::class]);

This will skip the default handlers and use only the ones you specified. Passing null instead of an array will use the default handlers/transformers.

About

PHP library for providing data structure and tools to parse schema

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages