This is a code sample from one of our projects for review. APIs are developed in Laravel.
PHP 8.1 Larave 9.44
- Clone bitbucket
git clone https://github.com/TechnourceDeveloper/TC-review-source-web-api.git
- Install dependency
composer install
- Copy .env.example and create .env file
sudo cp .env.example .env
- Generate a new application key
php artisan key:generate
- Environment variables in .env
For update .env file using cmd use below command
sudo nano .env
Set below varibale for database connection with your database
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=laravel
DB_USERNAME=root
DB_PASSWORD=
Set below varibale for SMTP connection for send email
MAIL_MAILER=smtp
MAIL_HOST=mailhog
MAIL_PORT=1025
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
MAIL_FROM_ADDRESS=null
MAIL_FROM_NAME="${APP_NAME}"
- Migrate and seed database with tablses and predefined data
php artisan migrate:fresh --seed
- Generate symlink
php artisan storage:link
- Start the local development server
php artisan serve
You can now access the server at http://localhost:8000 Testing API The api can now be accessed at
http://localhost:8000/api/v1