Recruitment Test: PHP Laravel Application with OAuth2 Authentication
Objective:
Develop a REST API in Laravel with OAuth2 authentication, including CRUD operations for
a Customer Database Management Portal. Implement a UI to interact with the API and
ensure comprehensive testing and documentation.
Requirements:
1. REST API Development:
o Build a REST API using Laravel.
o Include OAuth2 authentication for secure access (use Laravel Passport or
another default Laravel package for OAuth2 management).
o Implement CRUD operations using the following HTTP verbs:
§ Create: POST
§ Read: GET
§ Update: PUT
§ Delete: DELETE
2. Database:
o Use a MySQL database with a customer table. The structure is as follows:
CREATE TABLE customer (
id INT(11) NOT NULL AUTO_INCREMENT,
first_name VARCHAR(50),
last_name VARCHAR(50),
age INT(3),
dob DATE,
email VARCHAR(100),
creation_date TIMESTAMP,
PRIMARY KEY (id)
);
o Use the default Laravel users table for managing authentication. You may
create any user of your choice for testing.
3. UI Implementation:
o Develop the following pages using Laravel's default Blade template engine:
§ User Login Page:
§ Implement multi-factor authentication (MFA).
§ Send an MFA token to the user’s email for verification during
login.
§ Customer List Page: Display all customers from the database.
§ Customer Creation Page: Allow adding new customers.
§ Customer Details Update Page: Provide options to edit customer
information.
§ Delete Option: Enable deletion of a customer.
o All CRUD operations should be performed through the REST API.
4. Testing:
o Use PHPUnit to write test cases for the API. Ensure coverage for
authentication, validation, and CRUD operations.
5. Environment:
o Choose an environment suitable for the task. Docker is preferred for hosting
the REST API, but other environments can be used.
6. Documentation:
o Auto-generate API documentation
o Add inline documentation for the RESTful APIs.
Submission:
1. Upload your code to a GitHub repository.
2. Include a README.md file with:
o Setup instructions for the environment.
o Steps to run the API and UI.
o Instructions to execute test cases.
3. Share the GitHub repository link for code review.
Evaluation Criteria:
1. Correct implementation of OAuth2 authentication and CRUD operations.
2. Functional and user-friendly UI.
3. Comprehensive PHPUnit test coverage.
4. Clear and well-organized documentation.
5. Code quality, including adherence to Laravel best practices.