/php-csv-to-chart

Convert a csv file to chart using chart.js

Primary LanguagePHP

About the project

This is a project that reads a csv file with data of dollar rate and the date but i am required to read the csv file and convert it to a virtual presentation in php

Approaches

  • I will use chart.js for a chart representaton
  • I used php-router library for easy routing.
  • For showing the chart i built a mini api to be consumed by the frontend while other datas are been echoed out directly

Running it

Clone the project
 git clone https://github.com/codad5/php-csv-to-chart
Install all dependecies
composer install
Serve Your Project
php -S localhost:2000

Screenshot

Screenshot

Added Filter

Screenshot

Routes

  • Index route / - This Shows the list of all avaliable rates and dates and also show then in a chart form
  • /rates/:date - This is to show the rate of a particular date given
  • /api/rates - This is to get all rate data
  • /api/rates/:date - This is to get a particular rate based on the given date