The script accepts the different data sources with array data, does some calculations, and out it as formatted table.
Tested on PHP v. 7.3 and higher
In general, use next command line syntax:
php console.php import <json_file/php_file> <correct path to file>
Examples
php console.php import json_file data/data.json
php console.php import php_file data/data.php
or for running via Docker (without php environment on your host) you can use
docker run -it --rm --name my-running-script -v "$PWD":/usr/src/myapp -w /usr/src/myapp php:7.4-cli php console.php import json_file data/data.json
Also, you can send json-data directly as parameter:
php console.php plaintext json '[{"asd":"fgh"},{"qwe":"rty"},{"asd":"123"},{"asd":"xxx","qwe":"ccc"}]'
Project has simple MVC structure. (detailed phpDoc available in phpDoc)
console.php - the entry-point. just running the app
Service Locator for storing application components.
A base class for all controllers.
Access the router and start the controller.
A base class for all models.
Simple router. Expects params in next order: <controller> <action> [extra params] If params does not exist - uses the default values
Manual page.
Accepts input data from file
Accepts input data as plain text from command line
Main data-model Can be created from one array immediately.
View for help-page
Common view for datatable display