- PHP 8.1 or higher
- Clone the project from the repository
- Run
composer install
to install the dependencies - Run
php artisan key:generate
to generate the application key - Copy the
.env.example
file to.env
- Create a new mysql database and update the next variables in
.env
using your database credentials:DB_DATABASE=your_database DB_USERNAME=your_username DB_PASSWORD=your_password
- Run
php artisan migrate --seed
to create the database tables - Done! You can now run the project using
php artisan serve
- To run the tests, use
php artisan test
(should show green otherwise there is an issue in your configuration, please check the steps above)
The API documentation is available at /docs
route. You can access it by running the project php artisan serve
and visiting http://127.0.0.1:8000/docs
(the host name may different on your machine).
Please use the next token in the documentation to call endpoint (basic auth):
Basic dGVzdEBleGFtcGxlLmNvbToxMjM0NTY=
Note: if you can't call the docs please verify that the host in the browser and APP_URL in .env matches:
APP_URL=http://127.0.0.1:8000
If you updated the above variable please stop existing execution and use the next commands:
php artisan scribe:generate
php artisan serve
How to call api/files/verification SCREENSHOT
This document provides an overview of the file verification logic implemented in the FileVerificationController
.
POST api/files/verification
The file verification logic is designed to process uploaded files, verify their contents, and store the verification results in the database. The main components involved in this process are:
- FileVerificationController: Handles the file upload and verification logic.
- Input: HTTP request containing the uploaded file.
- Output: JSON response with the verification result and issuer name.
- VerifyFile: Action class that responsible for validating the uploaded file.
It uses pipe pattern to validate the file with 3 following pipes:
- ValidateIssuer: Validate the issuer of the file.
- ValidateRecipient: Validate the recipient of the file.
- ValidateSignature: Validate the signature of the file. This method been chosen to separate the file validation logic into smaller pieces and make it easier to test and maintain. Also it allows to add new verification step by adding new pipe.
- VerificationRepository: Store validation result into
Verification
model. - FileVerificationControllerTest: Contains test cases to ensure the file verification logic works as expected.
-- [knuckleswtf/scribe] (https://scribe.knuckles.wtf/laravel/) - Generate OPEN API documentation from Laravel code