The Website and API
- PHP 8.x
- MySQL
- Composer
- Node.js & NPM
-
Clone the repository
-
Install PHP dependencies:
composer install
-
Install NPM dependencies:
npm install
-
Copy environment file:
cp .env.example .env
-
Configure your
.envfile with database credentials and other settings -
Generate application key:
php artisan key:generate
-
Run database migrations:
php artisan migrate
-
Install Laravel Passport:
php artisan passport:install
-
Create Passport clients (if not already created):
# Create personal access client (for API tokens) php artisan passport:client --personal # Create password grant client (for web authentication) php artisan passport:client --password
For running tests, you need a separate test database to avoid affecting your development data.
-
Create a test database:
CREATE DATABASE laravel_balance_test; GRANT ALL PRIVILEGES ON laravel_balance_test.* TO 'your_db_user'@'localhost';
-
Create
.env.testingfile:cp .env .env.testing
-
Update
.env.testingwith test database configuration:APP_ENV=testing DB_CONNECTION=mysql DB_DATABASE=laravel_balance_test CACHE_DRIVER=array SESSION_DRIVER=array QUEUE_CONNECTION=sync
-
Run migrations on test database:
php artisan migrate:fresh --env=testing
Run all tests:
php artisan testRun tests and stop on first failure:
php artisan test --stop-on-failureRun specific test file:
php artisan test tests/Feature/Admin/UsersControllerTest.phpRun specific test method:
php artisan test --filter="test_method_name"The test database uses DatabaseTransactions trait, which means:
- Each test runs in a transaction that gets rolled back after the test
- Data from one test doesn't affect another test
- Your development database remains untouched
To refresh the test database schema:
php artisan migrate:fresh --env=testingphp artisan serveDevelopment build:
npm run devProduction build:
npm run buildWatch for changes:
npm run watch