Laravel application for Matrix multiplication. The app features a REST API with authentication.
- Clone the repository using
git clone https://github.com/tosinibrahim96/Matrix-multiplier.git
- Create a
.env
file in the root folder and copy everything from.env-sample
into it - Fill the
.env
values with your Database details as required
- Download WAMP or XAMPP to manage APACHE, MYSQL and PhpMyAdmin. This also installs PHP by default. You can follow this tutorial
- Download and install composer globally on your system
install all project dependencies and generate application key
$ composer install
$ php artisan key:generate
migrate all tables and seed required data into the database
$ php artisan migrate:fresh --seed
start your Apache server and MySQL on WAMP or XAMPP interface serve your project using the default laravel PORT or manually specify a PORT
$ php artisan serve (Default PORT)
$ php artisan serve --port={PORT_NUMBER} (setting a PORT manually)
POST /api/v1/register
-> Create a new account
{ Headers "Accept":"application/json", Body "name": Firstname Lastname, "email":"fnamelname@gmail.com", "password": "randompassword, "password_confirmation":"randompassword" }
Sample response "status": 201, "data": { "user": { "id": 25, "name": "Second account", "email": "secondaccount@gmail.com", "created_at": "2021-06-13T12:23:47.000000Z" }, "token": "9|23AejhmabdkrAgTH5tEEJSzpF9zXnLrpmWeNtjbs" },"message": "Account Created Successfully."
POST /api/v1/login
-> Login into created account
{ Headers "Accept":"application/json", Body "email": "fnamelname@gmail.com", "password":"randompassword" }
Sample response "status": 200, "data": { "user": { "id": 25, "name": "Second account", "email": "secondaccount@gmail.com", "created_at": "2021-06-13T12:23:47.000000Z" }, "token": "9|23AejhmabdkrAgTH5tEEJSzpF9zXnLrpmWeNtjbs" },"message": "Login Successful."
POST /api/v1/logout
-> Logout of your account
{ Headers "Authorization":"Bearer $token", "Accept":"application/json", }
Sample response "status": 200, "data":[], "message": "Logout Successful."
POST /api/v1/matrix/multiply
-> Multiply matrices and generate resulting matrix
{ Headers "Authorization":"Bearer $token", "Accept":"application/json", Body "matrix1_row_count":2, "matrix1_column_count":3, "matrix2_row_count":3, "matrix2_column_count":4, "matrix1_data":[1,1,1,2,2,2], "matrix2_data":[1,4,7,10,2,5,8,11,3,6,9,12] }
Sample response "status": 200, "data": { "matrix": [ ["F","O","X","AG"], ["L","AD","AV","BN"] ], "rows_count": 2, "columns_count": 4 }, "message": "New Matrix Generated Successfully."
- MIT license
- Copyright 2021 © Ibrahim Alausa.