https://github.com/stefan-500/products-categories-rest-api
Laravel REST API Application
https://github.com/stefan-500/products-categories-rest-api
rest-api
Last synced: 2 months ago
JSON representation
Laravel REST API Application
- Host: GitHub
- URL: https://github.com/stefan-500/products-categories-rest-api
- Owner: stefan-500
- Created: 2025-02-15T13:04:19.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-02-18T18:21:38.000Z (over 1 year ago)
- Last Synced: 2025-02-18T19:31:54.209Z (over 1 year ago)
- Topics: rest-api
- Language: PHP
- Homepage:
- Size: 126 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Laravel REST API for Product Management
This project is a REST API built with Laravel, designed to handle product management, including parsing a CSV file, managing product data and exporting HTTP response data to a new CSV file.
## Features
- **REST API implementation**
- **CSV file processing and import**
- **CRUD implementation**
- **Category-based product filtering**
- **JSON data export to CSV file**
## CSV File Processing
The CSV file for processing must be located in the project's root folder.
To parse the CSV file and store data in the database, run the following Artisan command:
```
php artisan import:products-csv
```
## API Usage and Testing
For testing API functionalities, use **Postman** or any API testing tool.
- Base URL:
```
http://127.0.0.1:8000/api/
```
- Available Endpoints:
| Method | Endpoint | Description |
|--------|---------------------------------------------|----------------------------------------------|
| **GET** | `/api/products` | Fetch products (general data) |
| **GET** | `/api/products-specific` | Fetch products (product specific data) |
| **GET** | `/api/category-products` | Fetch products by category |
| **GET** | `/api/categories` | Fetch categories |
| **PUT** | `/api/categories/{category}` | Update category name |
| **DELETE** | `/api/categories/{category}` | Delete a category |
| **PUT** | `/api/products/{product}` | Update a product |
| **DELETE** | `/api/products/{product}` | Delete a product |
| **POST** | `/api/category-products` | Generate a CSV of products for a category |
- Few examples of **HTTP request parameters** are located in **routes/api.php** as comments above each route definition.
## ER Diagram

## Possible Improvements
- **Implement soft deletion and update migration tables with proper ``onDelete`` constraints**
- **Modify ``ProductController@update`` to allow updating a product's category and manufacturer**
- **Implement rate limiting for API endpoints**
## License
This project is open-source and available under the [MIT License](LICENCE).