Prerequisites
Before starting, ensure you have these installed:
- PHP 8.2 or higher
- Composer (PHP dependency manager)
- Node.js and NPM (for frontend assets)
- MySQL or SQLite (for the database)
Installation Steps
Install PHP and Composer
First, install PHP 8.4 and Composer using the appropriate command for your operating system:
Install dependencies
Install both PHP and Node.js dependencies:This will install all required packages including:
- Laravel 12 framework
- JWT authentication (tymon/jwt-auth)
- Scramble API documentation (dedoc/scramble)
- Spatie Laravel Permission
Configure environment
Create your environment configuration file:By default, the API is configured to use SQLite for simplicity. To use MySQL instead, edit your
.env file:For development, SQLite is recommended as it requires no additional setup.
Generate application key
Generate the Laravel application encryption key:This command will set the
APP_KEY value in your .env file automatically.Generate JWT secret
Generate the JWT authentication secret:This will add the JWT secret to your
.env file for token generation and validation.Run database migrations
Set up the database schema by running migrations:This creates all necessary tables for users, articles, categories, support requests, and repair requests.
Verify Installation
Once the server is running, verify your installation:-
Check API health: Open your browser and navigate to:
-
Access API documentation: View the auto-generated API documentation at:
-
Test authentication endpoint: Try the login endpoint:
The API documentation is powered by Scramble and includes interactive examples for all endpoints.
What’s Next?
Installation Guide
Detailed installation instructions and troubleshooting
API Reference
Explore all available endpoints and examples
Authentication
Learn about JWT authentication flow
Environment Setup
Advanced configuration options