Appearance
Getting Started
Get up and running with MyWarranties in 5 minutes.
Prerequisites
Before you begin, ensure you have:
- PHP 8.3 or higher
- Composer 2.0 or higher
- MySQL 8.0 or PostgreSQL 13+
- Git for version control
Quick Installation
1. Clone the Repository
bash
git clone https://github.com/yourusername/mywarranties-backend.git
cd mywarranties-backend2. Install Dependencies
bash
composer install3. Configure Environment
bash
cp .env.example .envEdit .env with your settings:
env
DATABASE_URL="mysql://user:password@127.0.0.1:3306/mywarranties"
JWT_PASSPHRASE=your_secure_passphrase
MAILER_DSN=smtp://resend:re_your_api_key@smtp.resend.com:5874. Generate JWT Keys
bash
php bin/console lexik:jwt:generate-keypair5. Create Database
bash
php bin/console doctrine:database:create
php bin/console doctrine:migrations:migrate6. Start Server
bash
symfony server:start
# or
php -S localhost:8000 -t public/Your First API Call
Get a JWT Token
bash
curl -X POST http://localhost:8000/api/login \
-H "Content-Type: application/json" \
-d '{
"email": "test@example.com",
"password": "password123"
}'Response:
json
{
"token": "eyJ0eXAiOiJKV1QiLCJhbGc...",
"user": {
"id": 1,
"email": "test@example.com"
}
}Create a Product
bash
curl -X POST http://localhost:8000/api/products \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "iPhone 15",
"brand": "Apple",
"category": "Electronics",
"purchaseDate": "2024-01-15",
"warrantyPeriodMonths": 12
}'Create a Warranty Claim
bash
curl -X POST http://localhost:8000/api/claims \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"productId": 1,
"description": "Screen not working properly"
}'Next Steps
- Email Integration - Configure email and webhooks
- API Reference - Explore all endpoints
- CLI Commands - Learn console commands
- What is MyWarranties? - Understand the system
