Git Product home page Git Product logo

test-project-12's Introduction

Simple CLI app

The script accepts the different data sources with array data, does some calculations, and out it as formatted table.

Requirements

Tested on PHP v. 7.3 and higher

Run

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"}]'

Design

Project has simple MVC structure. (detailed phpDoc available in phpDoc)

console.php

console.php - the entry-point. just running the app


App

App.php

Service Locator for storing application components.

Controller.php

A base class for all controllers.

Kernel.php

Access the router and start the controller.

Model.php

A base class for all models.

Router.php

Simple router. Expects params in next order: <controller> <action> [extra params] If params does not exist - uses the default values


Controllers

Man.php

Manual page.

Import.php

Accepts input data from file

Plaintext.php

Accepts input data as plain text from command line


Models

DataSet.php

Main data-model Can be created from one array immediately.


Views

ManIndexView.php

View for help-page

DataTableView.php

Common view for datatable display

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.