/mkm

Primary LanguagePHP

MKM Test

Installation

Requirements

  • PHP ^8.0
  • Composer
  • Laravel 11
  • Laravel Valet (optional, for local development with Valet)

General Installation Steps

  1. Clone the repository to your local machine

    git clone https://github.com/ogunsakin01/mkm.git
  2. Change into the project directory

    cd mkm
  3. Install project dependencies using Composer:

    composer install
  4. Copy the .env.example file to create a new .env file

    cp .env.example .env
  5. Generate the application key

    php artisan key:generate
  6. Generate JWT secret using this command below

    php artisan jwt:secret
  7. Create a database in your local environment and update the database connection settings in the .env file according to your database setup

    DB_CONNECTION=****
    DB_HOST=****
    DB_PORT=****
    DB_DATABASE=****
    DB_USERNAME=****
    DB_PASSWORD=****
  8. Run database migrations and seed the database

    php artisan migrate
  9. Clear the application cache

    php artisan optimize:clear

Starting the application

  • To start the application, you can use the built-in Laravel development server:
    php artisan serve
  • Or you can directly use PHP built-in server:
    php -S localhost:8000 -t public/
  • If you choose to use Laravel Valet, run the command below to have it available at http://mkm.test:
    valet link
  • Or if you wish to test locally with SSL, run the command below to have it available at https://mkm.test:
    valet secure

Importing products.csv to the database

  • Setup you queue connection in the env file to database

     QUEUE_CONNECTION=database
  • The import process makes use of Jobs and queues. To start the queue worker, run:

    php artisan queue:listen
  • Ensure the file to export is named products.csv and is in the public directory. This CSV file must also have the headers: name, sku, brand, and description.

  • If this condition has been met, proceed to access the route http://127.0.0.1:8000/import, and the entire process will run in the background.

API Documentation

  • You can find the API documentation here.