This repository provides a simple CRUD (Create, Read, Update, Delete) API built using the Laravel framework. The API allows you to manage resources through basic HTTP operations. This README.md file serves as a guide to help you understand the project structure, set up the environment, and start using the API.
Before getting started, ensure that you have the following prerequisites installed on your system:
- PHP (>= 7.4)
- Composer
- Laravel (>= 8.0)
- MySQL (or any other supported database)
- Clone the repository to your local machine:
git clone https://github.com/your-username/crud-api-laravel.git
- Navigate to the project directory:
cd crud-api-laravel
- Install the dependencies using Composer:
composer install
-
Create a copy of the
.env.example
file and rename it to.env
. Update the database connection details within this file according to your environment setup. -
Run the database migrations to create the required tables:
php artisan migrate
- seed the database with sample data, run the following command:
php artisan db:seed
- Start the development server:
php artisan serve
The following endpoints are available:
GET /api/v1/product
- Get all productGET /api/v1/product/{id}
- Get a specific product by IDPOST /api/v1/product
- Create a new productPUT /api/v1/product/{id}
- Update a product by IDDELETE /api/v1/product/{id}
- Delete a product by ID