Docs Contributing
Development setup
Install BYOMailer on your computer with PHP 8.4, Node 24 and SQLite, and fill it with demo data.
This page tells you how to run BYOMailer on your computer for development. To run an instance for real use, read Manual installation or Docker installation.
For the structure of the code, read Architecture.
Requirements
| Item | Version | Note |
|---|---|---|
| PHP | 8.4.1 or later, not 8.5 | Extensions: bcmath, exif, gd, intl, pdo_sqlite, redis. The CI also loads zip. |
| Composer | Installs the PHP packages. | |
| Node | 24 | The .nvmrc file names the version. Vite 7 and Vitest 4 fail on older versions. |
| Redis | Optional | Only the jobs that send email need it. Read Send email locally. |
Why PHP 8.5 does not work
composer.json accepts PHP ^8.3, but composer.lock sets the limits:
phpoffice/phpspreadsheet1.30.5 requires PHP>=7.4.0 <8.5.0.maatwebsite/excelneeds this package for the imports and exports.- The Symfony 8 packages, for example
symfony/console, require PHP>=8.4.1.
Thus composer install accepts PHP 8.4.1 to 8.4.x only. The Dockerfile and the CI also use PHP 8.4.
Install
-
Clone the app repository and go into its folder.
-
If you use nvm, run
nvm use. -
Run the setup script:
composer setup -
Create the owner account:
php artisan byomailer:install -
Start the development processes:
composer dev -
Open
http://localhost:8000and log in with the owner account.
composer setup does these steps:
- It runs
composer install. - It copies
.env.exampleto.env, if.envdoes not exist. - It runs
php artisan key:generate. - It runs
php artisan migrate --force. Ifdatabase/database.sqlitedoes not exist, the migration creates it. - It runs
npm installandnpm run build.
npm run build also makes the SSR bundle in bootstrap/ssr. The PHP tests turn off SSR, so they pass while that folder exists. Read Testing.
The owner account
php artisan byomailer:install asks for a name, an email and a password. You can also give them as options:
php artisan byomailer:install --name="Dev Owner" --email=owner@example.com --password=<password> --timezone=UTC
| Option | Use |
|---|---|
--name, --email, --password |
The data of the owner. If an option is missing, the command asks for it. |
--timezone |
The timezone of the account. The default is UTC. |
--promote=<email> |
Make an existing user an owner. The command creates no account. |
--prepare |
Prepare the instance only, and create no account. |
The command creates only the first user. If a user exists, it stops with an error. Use --promote then.
You can also create the owner on the setup page. Run php artisan byomailer:setup-url to get the URL with the setup token. For more, read Accounts and registration.
Use the host of APP_URL
.env.example sets APP_URL=http://localhost. php artisan serve shows http://127.0.0.1:8000, but open http://localhost:8000 instead.
The RestrictHostToLinkRoutes middleware compares the host of each request with the host of APP_URL. The port is not part of the host. A request on another host, for example 127.0.0.1, gets 404. If you want a different host, change APP_URL.
What composer dev starts
composer dev starts four processes with concurrently:
| Name | Command | Use |
|---|---|---|
server |
php artisan serve |
The web server on port 8000 |
queue |
php artisan queue:listen --tries=1 |
A queue worker |
logs |
php artisan pail --timeout=0 |
The log viewer |
vite |
npm run dev |
The Vite dev server with hot reload |
composer dev does not start the scheduler or Horizon. Note these limits:
- The
queueprocess reads only thedefaultqueue. The jobs on thenewsletter,sequences,automations,ses-events,tracking-domainsandwebhooksqueues stay in the queue. - Scheduled newsletters and sequence steps need the scheduler.
If you work on these parts, start the missing processes in another terminal:
php artisan queue:listen --tries=1 --queue=default,newsletter,sequences,automations,ses-events,tracking-domains,webhooks
php artisan schedule:work
composer dev:ssr builds the SSR bundle and starts php artisan inertia:start-ssr in place of Vite.
Local settings
.env.example sets these values for local development:
| Variable | Value | Effect |
|---|---|---|
DB_CONNECTION |
sqlite |
The database is database/database.sqlite. |
QUEUE_CONNECTION |
database |
Jobs go to the jobs table. |
CACHE_STORE |
database |
The cache uses the database. |
SESSION_DRIVER |
database |
Sessions use the database. |
MAIL_MAILER |
log |
System mail goes to the log. |
INERTIA_SSR_ENABLED |
true |
Inertia tries server-side rendering. |
MAIL_MAILER controls the system mail of the instance only. Campaign email goes through the SES account of each account. Read Architecture.
For all variables, read Configuration.
Demo data
The seeder fills the database with a demo account. Run it one time:
php artisan db:seed
The seeder creates:
- The user
demo@example.comwith the passwordpassword. The account uses the timezoneAmerica/New_York. - AWS credentials and two sender identities.
- Three lists with topics, five tags and 500 contacts with attributes.
- Newsletters, sequences, visual automations and email templates, with sent mails and clicks.
The demo user is not an owner. To make it an owner, run php artisan byomailer:install --promote=demo@example.com. If you run the seeder after php artisan byomailer:install, the instance has two accounts.
TEST_* variables
The seeder reads these optional variables. If a variable is not set, the seeder uses the default value. .env.example lists them as comments.
| Variable | Default | Use |
|---|---|---|
TEST_AWS_KEY_ID |
A fake key | The AWS access key of the demo account |
TEST_AWS_KEY_SECRET |
A fake secret | The AWS secret key of the demo account |
TEST_AWS_REGION |
us-east-1 |
The AWS region of the demo account |
TEST_SNS_TOPIC_ARN |
A fake ARN | The SNS topic of the demo account |
TEST_SNS_SUBSCRIPTION_ARN |
A fake ARN | The SNS subscription of the demo account |
TEST_EMAIL_FROM |
updates@example.com |
The email of the first sender identity |
TEST_EMAIL_NAME |
Updates Team |
The name of the first sender identity |
TEST_EMAIL_DOMAIN |
Empty | The domain of both sender identities. The second identity uses announcements@<domain>. |
TEST_EMAIL_FROM_SUBDOMAIN |
Empty | The MAIL FROM subdomain |
TEST_EMAIL_REGION |
The value of TEST_AWS_REGION |
The SES region of the sender identities |
TEST_EMAIL_STATUS |
verified |
The status of the sender identities |
TEST_EMAIL_CONFIGURATION_SET |
Empty | The SES configuration set of the first sender identity |
Warning: Do not put real AWS keys in TEST_AWS_KEY_ID and TEST_AWS_KEY_SECRET unless you want real email. With real keys, a local send goes through your SES account to the demo contacts.
Send email locally
Each campaign email goes through the SES API with the AWS keys of the account. The fake keys of the seeder make AWS refuse the call. To send real email, connect a real SES account in the dashboard. Read Connect AWS SES.
The jobs that send newsletters and sequence steps use the ses-sending rate limiter. It needs Redis. Install Redis, and set REDIS_HOST and REDIS_PORT in .env.
Caution: Before you run a send command by hand, make sure that the local database has no real AWS credentials. To check the send code, write a test. Read Testing.