Welcome to the Send Message Test Task project! This README provides essential information for setting up and running the API. Whether you're a developer or a client, this guide will help you get started.
This project is an API that facilitates communication between users. It allows sending messages (via SMS or email) and retrieving conversation logs. The codebase is written in PHP using the Laravel framework.
Before you proceed, ensure you have the following installed:
- PHP
- Composer
- MySQL
-
Clone the repository:
git clone https://github.com/vishstack/send-message-test-task.git cd send-message-test-task
-
Install dependencies:
composer install
-
Create a
.env
file by copying.env.example
:cp .env.example .env
-
Configure your database connection in
.env
:DB_CONNECTION=mysql DB_HOST=127.0.0.1 DB_PORT=3306 DB_DATABASE=your_database_name DB_USERNAME=your_database_user DB_PASSWORD=your_database_password
-
Generate an application key:
php artisan key:generate
-
Run database migrations:
php artisan migrate
To start the development server, run:
php artisan serve
The API will be accessible at http://localhost:8000
.
-
Send a Message:
- Endpoint:
POST /api/messages
- Parameters:
from_user_id
: ID of the sender (required)to_user_id
: ID of the recipient (required)type
: Message type ('sms' or 'email', required)message
: Content of the message (required)
- Endpoint:
-
Retrieve Conversation Logs:
- Endpoint:
GET /api/conversation-logs
- Parameters:
user1
: First user ID or email (required)user2
: Second user ID or email (optional)per_page
: Number of items per page (optional, default is 5)page
: Page number (optional, default is 1)
- Endpoint: