PROJECT 3 POSTMAN
PROJECT 3 POSTMAN
ABSTRACT
This project involves building a Task Manager Application using Laravel, a popular PHP framework, to
provide a robust backend for managing tasks via a REST API. The API will be tested using Postman, ensuring
seamless CRUD (Create, Read, Update, Delete) operations.
Key Features
User Authentication: Secure login and registration using Laravel Sanctum.
Task Management: Users can create, update, delete, and retrieve tasks.
Postman Testing: API endpoints will be tested and validated using Postman.
Technology Stack
Backend: Laravel (PHP)
Database: MySQL
The primary objective of this project is to develop a Task Manager Application using Laravel, a PHP
framework, to efficiently manage tasks through a REST API. The API will be designed following best
practices for security, scalability, and performance. Postman will be used for testing and validation to ensure
smooth CRUD (Create, Read, Update, Delete) operations.
Each task should have attributes like title, description, status, priority, and due date.
Follow REST API standards, ensuring clear request and response handling.
Ensure proper error handling, status codes, and responses for robustness.
Implement migrations and seeders for easy database setup and testing.
Optimize API Performance and Security:
Use Laravel Eloquent ORM for database interactions.
Implement middleware for security and validation of API requests
INTRODUCTION
In today's fast-paced digital environment, efficient task management is essential for personal productivity and
team collaboration. A Task Manager Application provides a structured way to create, track, and manage tasks
effectively. This project focuses on developing a Task Manager App using Laravel, a powerful PHP framework
known for its elegant syntax, robust features, and scalability.
This application will expose a REST API to handle task management functionalities, including user
authentication, task creation, updating, deletion, and categorization. The API will follow RESTful principles to
ensure structured communication between the frontend (or clients) and the backend.
To validate and test the API, Postman will be used as a testing tool. Postman allows developers to send API
requests, inspect responses, and ensure the API is functioning correctly. This approach ensures smooth
development, debugging, and optimization of the API.
Laravel is chosen as the backend framework due to its:
MVC Architecture, which ensures code maintainability and separation of concerns.
Eloquent ORM, which simplifies database interactions.
Built-in Authentication System, which provides secure API authentication via Laravel Sanctum.
Middleware Support, which allows efficient request validation and security handling.
Project Scope
This Task Manager App will include features such as:
✅ User Registration & Login (API token-based authentication with Laravel Sanctum)
✅ Task CRUD Operations (Create, Read, Update, Delete tasks)
✅ Task Categorization (Priorities, labels, or custom categories)
✅ REST API Development (Well-structured endpoints using Laravel controllers)
✅ API Testing using Postman (Ensuring endpoint correctness and security)
METHODOLOGY
sh
CopyEdit
cd TaskManager
php
CopyEdit
use Laravel\Sanctum\Http\Middleware\EnsureFrontendRequestsAreStateful;
protected $middlewareGroups = [
'api' => [
EnsureFrontendRequestsAreStateful::class,
'throttle:api',
\Illuminate\Routing\Middleware\SubstituteBindings::class,
],
];
Run migrations:
sh
CopyEdit
CopyEdit
use Laravel\Sanctum\HasApiTokens;
php
CopyEdit
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use HasFactory;
return $this->belongsTo(User::class);
php
CopyEdit
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateTasksTable extends Migration
$table->id();
$table->foreignId('user_id')->constrained()->onDelete('cascade');
$table->string('title');
$table->text('description');
$table->date('due_date')->nullable();
$table->timestamps();
});
Schema::dropIfExists('tasks');
Run migrations:
sh
CopyEdit
php
CopyEdit
use App\Http\Controllers\AuthController;
use App\Http\Controllers\TaskController;
use Illuminate\Support\Facades\Route;
Route::middleware('auth:sanctum')->group(function () {
Route::apiResource('tasks', TaskController::class);
});
php
CopyEdit
namespace App\Http\Controllers;
use App\Models\User;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Hash;
use Illuminate\Validation\ValidationException;
$request->validate([
]);
$user = User::create([
]);
$request->validate([
]);
$request->user()->tokens()->delete();
php
CopyEdit
namespace App\Http\Controllers;
use App\Models\Task;
use Illuminate\Http\Request;
return response()->json(auth()->user()->tasks);
$request->validate([
]);
$task = auth()->user()->tasks()->create($request->all());
return response()->json($task);
$request->validate([
]);
$task->update($request->all());
return response()->json($task);
$task->delete();
json
CopyEdit
"email": "[email protected]",
"password": "password123"
sh
CopyEdit
OUTPUT
Conclusion
The Laravel Task Manager App using REST API and Postman successfully demonstrates how to build a secure,
scalable, and efficient backend for task management. This project provides user authentication, task creation,
updating, deletion, and retrieval using Laravel's powerful features, including Sanctum for API authentication
and Eloquent ORM for database interactions.
Through Postman testing, we validated API endpoints, ensuring proper error handling, authentication security,
and data consistency. This project serves as a solid foundation for developing a full-fledged task management
system, which can be extended with a frontend (React, Vue, or Angular) or integrated with mobile applications.