Otrium a fast-growing e-commerce company that serves more than 2 million customers. The company has been running for several years and is now going through its growth stage. This is an internal reporting tool designed with very specific requirements and is highly opinionated.
No frameworks of any type have been used on this application although third-party libraries were incorporated to ease development load.
CI/CD has been set up using Github Actions and can be found here.
Before you begin we recommend you read about the basic building blocks that assemble the application:
- MySQL - Go through MYSQL Official Website and proceed to their Official Manual, which should help you understand MySQL better.
- Composer - The best way to understand PHP composer is through its Official Website, which has a Getting Started guide.
- PHP - PHP's Official Website is a great starting point.
Make sure you have installed all of the following prerequisites on your development machine:
- Git - Download & Install Git. OSX and Linux machines typically have this already installed.
- PHP - Download & InstallPHP and the PHP package manager composer. If you encounter any problems, you can also use this guide to install PHP.
- MySQL - Download & Install MySQL, and make sure it's running on the default port (3306).
- Composer - You're going to use the Composer Package Manager to manage your PHP packages. Make sure you've installed PHP first, then install composer globally:
# MacOS
$ brew install composer
# Windows
$ choco install composer
# Linux
$ sudo apt-get update
$ php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
There are several ways you can get the Otrium App:
The recommended way to get Otrium App is to use git to directly clone the Otrium App repository:
$ git clone https://github.com/Thavarshan/otrium.git
This will clone the latest version of the Otrium App repository to a otrium folder.
Another way to use the Otrium App is to download a zip copy from the main branch on GitHub. You can also do this using the wget
command:
$ wget https://github.com/Thavarshan/otrium/archive/refs/heads/main.zip -O otrium.zip; unzip otrium.zip; rm otrium.zip
Don't forget to rename otrium-main as otrium.
Yet another way to download the Otrium application is to download the latest release build. You can find the latest release here.
Once you've downloaded the application and installed all the prerequisites, you're just a few steps away from starting to use the application.
The application comes pre-bundled with a composer.json
file that contains the list of packages you need to start your application.
To install the dependencies, run this in the application folder from the command line:
$ composer update
This command does a few things:
- First it will install the dependencies needed for the application to run.
- If you're running in a development environment, it will then also install development dependencies needed for testing and running your application.
- To update these packages later on, just run
composer update
again.
Before running the application itself, please import the test data provided in a .sql
file located within the data
directory. Dates have been modified so the report is generated for dates from the date you provide as an argument or by default today to the past 7 days.
Finally from within your command-line inside the downloaded otrium directory run:
$ cp .env.example .env && chmod +x bin/otrium
This is to set the application configurations and prepare them for usage. A file with the name .env
or .env.example
has been provided with otrium
. This is where you may save sensitive information regarding the application for instance the database credentials.
Make sure you rename .env.example
to .env
and set your MySQL
database credentials in the .env
file.
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=otrium
DB_USERNAME=
DB_PASSWORD=
To run the application. Open up the downloaded directory on your terminal application and run:
$ bin/otrium report:generate daily --from=2018-01-12
or
$ bin/otrium report:generate brand --from=2018-01-12
An argument must be provided when running the application. This is to determine what kind of report is to be generated.
Parameters | Description | Example Value |
---|---|---|
command | Name of the command to be run | report:generate |
name | Name of report to be generated | daily/brand |
from (optional) | Date from which report should be generated | 2018-01-12 (Y-m-d) |
The generated report CSV files can be found within the
reports
directory.
daily
- Generate 7 days turnover (excluding VAT) per day.brand
- Generate 7 days turnover per brand (excluding VAT) per day.
If you're not sure about how to run the command or want to know what commands are available run:
$ bin/otrium list
Thank you for considering contributing to Otrium! The contribution guide can be found here.
To ensure that the Otrium community is welcoming to all, please review and abide by the Code of Conduct.
Please review our security policy on how to report security vulnerabilities.
This is an exercise application and not a polished production-ready version. This app should not be used in a production environment and please mind the license provided.
This application is open-sourced software licensed under the MIT license.