- Install Docker and Docker Compose.
- Be mindful of which terminal you are using.
- Tags matching the terminal are provided inside the documentation.
- [Windows Only] OS Terminal - the terminal native to Windows.
- [WSL] WSL Terminal - the terminal inside the virtual machine.
- [Linux / MacOS] OS Terminal - the terminal native to your operating system.
- [Windows Only] Install the Linux distro
wsl --install -d Ubuntu-22.04
wsl --distribution Ubuntu-22.04
- [WSL / Linux / MacOS] Go to your home directory, create a folder for your projects (if you don't have one already) and get into it:
cd ~
mkdir Projects
cd Projects
- [WSL / Linux / MacOS] Clone the repository
git clone [email protected]:learnhubmk/api.git
- If you get the
permission denied (public key)
error while cloning the repository, you will have to add your public SSH key to your GitHub SSH keys settings.
- [WSL / Linux / MacOS] Get into your project directory
cd api
- [WSL / Linux / MacOS] Create an
.env
file by copying.env.docker.example
cp .env.docker.example .env
- [WSL / Linux / MacOS] Build up and start the Docker containers
docker compose up --build -d
- [WSL / Linux / MacOS] Enter the docker
app
docker container
docker exec -it LearnHub_app sh
- [Docker Container] Install the Composer dependencies
composer install
- [Docker Container] Run all migrations and database seeders
php artisan migrate --seed
- [Docker Container] Generate the application key (
APP_KEY
)
php artisan key:generate
- [Docker Container] Generate the JWT secret key (
JWT_SECRET
)
php artisan jwt:secret
- Access the site using http://localhost:8000 in your browser
Additional useful links that you may want to know about:
- The Laravel API - the Laravel API project
- Mailpit - the email client, all emails will come here when the API sends an email
- Laravel Horizon - The queue monitoring system for Redis queues
- Laravel Telescope - The monitoring system for your Laravel API, you can debug everything here.
- Open API v3 Documentation - the Open API v3 documentation for the project.
- PHPMyAdmin - the famous database UI.
- Install PHP 8.3 or later
Currently, XAMPP contains PHP 8.2, and may not work.
-
Install Composer 2.7.1 or later
-
Clone the repository
git clone https://github.com/learnhubmkd/api.git
- Get into your project directory
cd api
- Create an
.env
file by copying.env.example
- Windows:
xcopy .env.example .env /y /f
- Linux/Mac:
cp .env.example .env
- You can modify the
.env
file to test different configurations.
- Install composer dependencies
composer install
- Generate an application key (
APP_KEY
)
php artisan key:generate
- Generate the JWT secret key (
JWT_SECRET
)
php artisan jwt:secret
- Run all migrations and database seeders
php artisan migrate --seed
- Start the PHP server
php artisan serve
- Access the site using http://localhost:8000 in your browser
For the local emails that the API may send, you may want to use something like Mailtrap
For the database UI, you can use PHPMyAdmin, TablePlus, HeidiSQL, or MySQL Workbench.
- Laravel Socialite: SOCIALITE.md
- Laravel Scribe: SCRIBE.md
- Laravel Modular: MODULAR.md
- run php stan
./vendor/bin/phpstan analyse --memory-limit=2G
- run phpStan pro
./vendor/bin/phpstan --pro analyse --memory-limit=2G