Skip to content

Contributing

Andy Saw edited this page Aug 29, 2022 · 9 revisions

Dev Environment

Ensure you have Docker installed and set up.

Please also read the Laravel Sail documentation.

⚠️ If you're using Windows you will need to run it through WSL2, however we highly do not recommend developing on Windows due to the various inconsistencies and performance hits. Linux or MacOS is preferable.

First time setup

  1. Run cp .env.example .env, then edit the file as appropriate (see below)
  2. Run make bootstrap
  3. Run alias sail='[ -f sail ] && bash sail || bash vendor/bin/sail' to add the sail alias

You'll then be able to access the website on http://localhost

Development

Once First time setup is complete, you only need to run one command to boot up the environment:

sail up -d to start Sail

For front-end development, you'll want to run:

sail npm run watch to start NPM build. This also starts BrowserSync on http://localhost:3000

You can enter the container at any time with sail shell

Database

If the database schema has changed, remember to run sail artisan migrate ensure you always have the latest schema.

Mail

Access http://localhost:8025 to view any sent mail

S3 Bucket

Backups go to an S3 bucket specified in the backup disk. To run this functionality in development, you need to configure a valid bucket.

  1. Go to http://localhost:9000, using the credentials sail/password
  2. Make a bucket called pcb-backup

Stripe Webhooks

Use stripe-cli to receive payment webhooks locally.

After installing, run stripe listen --forward-to localhost/api/webhooks/stripe to forward webhook events to the correct endpoint. Copy the code you're given into the STRIPE_WEBHOOK_SECRET env value.

Linter

  • Run sail pint to run the linter. Any issues will be automatically fixed

Testing

  • Run sail test to run all unit/integration tests. Append the --parallel flag to run tests in parallel
  • Run sail bin phpstan to run PHP analysis

Account

The default admin account:

User: [email protected]

Pass: admin

If you're prompted for a 2FA code, you can use 0000 in dev

Clone this wiki locally