/data-factory-orange

School project with Orange, REST API in php.

Primary LanguageTSQL

ORANGE DATA FACTORY - PHP REST API

Installation and Running

Before starting with the project make sure you have the following dependencies:

  • php 7.2 or newer is installed.
  • composer
  • mysql
  1. Run composer update/install

In order to install the dependencies of this project and generate the vendor folder run the following:

$ cd /path_to_project/
$ composer update
$ composer install
  1. Create the environment file and logs directory:

First create the two files running on your bash:

cd /path_to_project/
touch .env
touch logs.log

Then adjust the permission to let the webuser have full access to them.

cd /path_to_project/
chown www-data .env
chown www-data logs.log
chmod 570 .env
chmod 570 logs.log
  1. Create Database and generate the configuration:

To create the database schema and fill it, import to mysql the seed.sql file.

Then proceed by running the database configuration script.

php DbConfig.php // This script supports flags, run with --help to see usage.

Optional:

If you would like to fill the database from a different seed, you can run DbFiller:

php DbFiller.php -c path_to_csv_file.csv // path_to_csv_file.csv serves as seed for newly created database.
  1. Run the API

To start the api on localhost listening on port 8000, run:

php -S 127.0.0.1:8000 -t public

alt