A simple REST API built with Laravel.
This project is for learning and experimenting with Laravel RESTful APIs, including CRUD operations.
- Laravel 10+ REST API
- CRUD example (Posts API)
- MySQL database integration
- Organized structure with Models, Controllers, and Routes
- PHP 8.1 or higher
- Composer
- MySQL (or MariaDB)
- Laravel CLI
-
Clone the repository:
git clone https://github.com/YOUR-USERNAME/YJ0411-REST-API-Laravel.git cd YJ0411-REST-API-Laravel/src
-
Install dependencies:
composer install
- Copy .env file and configure database:
cp .env.example .env
Update database credentials inside .env.
- Generate application key:
php artisan key:generate
- Run database migrations:
php artisan migrate
- Start local server:
php artisan serve
App will be running on π http://127.0.0.1:8000
Method | Endpoint | Description |
---|---|---|
GET | /api/health |
Health Check |
curl -X GET http://127.0.0.1:8000/api/health \
-H "Accept: application/json" \
-H "Content-Type: application/json"