Skip to content
Open

Dev #386

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
96 changes: 96 additions & 0 deletions .env.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
# This file is a "template" of what your .env file should look like.
# Set variables here that may be different on each deployment target of the app,
# e.g. development, staging, production.
#
# On `composer install`/`composer update`, this file is copied to `.env` (unless
# it already exists) and PHPLIST_SECRET is replaced with a freshly generated value.
#
# https://symfony.com/doc/current/configuration.html#configuring-environment-variables-in-env-files

PHPLIST_DATABASE_DRIVER=pdo_mysql
PHPLIST_DATABASE_PATH=
PHPLIST_DATABASE_HOST=127.0.0.1
PHPLIST_DATABASE_PORT=3306
PHPLIST_DATABASE_NAME=phplistdb
PHPLIST_DATABASE_USER=phplist
PHPLIST_DATABASE_PASSWORD=phplist
DATABASE_PREFIX=phplist_
LIST_TABLE_PREFIX=listattr_
PHPLIST_ADMIN_PASSWORD=admin
Comment thread
coderabbitai[bot] marked this conversation as resolved.

APP_DEV_VERSION=0
APP_DEV_EMAIL=dev@dev.com
APP_POWERED_BY_PHPLIST=0
PREFERENCEPAGE_SHOW_PRIVATE_LISTS=0

API_BASE_URL=http://api.phplist.local/
FRONT_END_BASE_URL=http://frontend.phplist.local

PARALLER_USE_WITH_PHPLIST3=0

# Email configuration
MAILER_FROM=noreply@phplist.com
MAILER_DSN=null://null
CONFIRMATION_URL=http://api.phplist.local/api/v2/subscriber/confirm/
SUBSCRIPTION_CONFIRMATION_URL=http://api.phplist.local/api/v2/subscription/confirm/
PASSWORD_RESET_URL=https://example.com/reset/
SHOW_UNSUBSCRIBELINK=1

# Bounce email settings
BOUNCE_EMAIL=bounce@phplist.com
BOUNCE_IMAP_PASS=bounce@phplist.com
BOUNCE_IMAP_HOST=imap.phplist.com
BOUNCE_IMAP_PORT=993
BOUNCE_IMAP_ENCRYPTION=ssl
BOUNCE_IMAP_MAILBOX=/var/spool/mail/bounces
BOUNCE_IMAP_MAILBOX_NAME=INBOX,ONE_MORE
BOUNCE_IMAP_PROTOCOL=imap
BOUNCE_IMAP_UNSUBSCRIBE_THRESHOLD=5
BOUNCE_IMAP_BLACKLIST_THRESHOLD=3
BOUNCE_IMAP_PURGE=0
BOUNCE_IMAP_PURGE_UNPROCESSED=0

# Messenger configuration for asynchronous processing
MESSENGER_TRANSPORT_DSN=doctrine://default?auto_setup=true

# A secret key that's used to generate certain security-related tokens
PHPLIST_SECRET=%s
VERIFY_SSL=1
Comment thread
coderabbitai[bot] marked this conversation as resolved.

APP_PHPLIST_ISP_CONF_PATH=/etc/phplist.conf

# Message sending
MAILQUEUE_BATCH_SIZE=5
MAILQUEUE_BATCH_PERIOD=5
MAILQUEUE_THROTTLE=5
MESSAGING_MAX_PROCESS_TIME=600
MAX_MAILSIZE=209715200
DEFAULT_MESSAGEAGE=691200
USE_MANUAL_TEXT_PART=0
MESSAGING_BLACKLIST_GRACE_TIME=600
GOOGLE_SENDERID=
USE_AMAZONSES=0
USE_PRECEDENCE_HEADER=0
EMBEDEXTERNALIMAGES=0
EMBEDUPLOADIMAGES=0
EXTERNALIMAGE_MAXAGE=0
EXTERNALIMAGE_TIMEOUT=30
EXTERNALIMAGE_MAXSIZE=204800
FORWARD_ALTERNATIVE_CONTENT=0
EMAILTEXTCREDITS=0
ALWAYS_ADD_USERTRACK=1
SEND_LISTADMIN_COPY=0

FORWARD_EMAIL_PERIOD="1 minute"
FORWARD_EMAIL_COUNT=1
FORWARD_PERSONAL_NOTE_SIZE=0
FORWARD_FRIEND_COUNT_ATTRIBUTE=
KEEPFORWARDERATTRIBUTES=0

UPLOADIMAGES_DIR=uploadimages
PHPLIST_UPLOADS_MAX_SIZE=5M

PUBLIC_SCHEMA=https
PHPLIST_ATTACHMENT_DOWNLOAD_URL=https://example.com/download/
PHPLIST_ATTACHMENT_REPOSITORY_PATH=/tmp
MAX_AVATAR_SIZE=100000
9 changes: 9 additions & 0 deletions .env.test.local.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Optional: copy this file to ".env.test.local" to run tests against an in-memory SQLite
# database instead of MySQL, so no database server is needed for `vendor/bin/phpunit`.
#
# Note: this file is not loaded automatically by PHPUnit CLI runs (this project's ApplicationKernel
# does not read .env files on its own); either export these as real environment variables before
# running phpunit, or wire them up via your own bootstrap/CI step.

PHPLIST_DATABASE_DRIVER=pdo_sqlite
PHPLIST_DATABASE_PATH=:memory:
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
/composer.lock
/config/bundles.yml
/config/config_modules.yml
/config/parameters.yml
/.env
/.env.local
/.env.*.local
/config/routing_modules.yml
/nbproject
/var/
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@ This project adheres to [Semantic Versioning](https://semver.org/).

### Added
- Graylog integration for centralized logging (#TBD)
- `symfony/dotenv` support: configuration values are now read from a `.env` file (generated from `.env.dist` on install/update), in addition to real environment variables (#TBD)

### Changed
- `config/parameters.yml.dist` no longer contains inline `env(VAR): default` fallbacks; defaults now live in `.env.dist` (#TBD)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Use the current parameters template path.

This entry names config/parameters.yml.dist, while the migrated template and ScriptHandler now use config/parameters.yml. Use the current path or explicitly describe the rename.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@CHANGELOG.md` at line 13, Update the changelog entry to reference the current
parameters template path, config/parameters.yml, or explicitly state that
config/parameters.yml.dist was renamed to config/parameters.yml; keep the
description of defaults moving to .env.dist unchanged.


### Deprecated

Expand Down
36 changes: 19 additions & 17 deletions PHPDOC.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,27 @@
# Class Documentation with PHPDoc
# Generating class documentation

We use [phpdoc](phpdoc.org) to automatically generate documentation for our annotated classes.
We use [phpDocumentor](https://phpdoc.org) to generate API docs from the docblocks on
our classes, properties, and methods. Output settings (title, output path) are defined
in [`phpdoc.xml`](phpdoc.xml); the generated docs are written to `docs/phpdocumentor/`
and are not committed to the repository.

So to be able to generate or update our class docs you would need to download and install `phpDocumentor` globally (for system wide use) as shown below:
## Install phpDocumentor

1. `cd ~` [*Optional : it's recommended to navigate to your home dir before downloading `phpDocumentor` as shown in step 2*]
2. `wget https://phpdoc.org/phpDocumentor.phar`
3. `chmod +x phpDocumentor.phar`
4. `mv phpDocumentor.phar /usr/local/bin/phpDocumentor`
phpDocumentor ships as a standalone `.phar`. Install it once, globally:

*Possibility : In case you don't want to install `phpDocumentor` globally you can skip step 4, however you would need to run `phpDocumentor` from whatever path it was installed in.*
```bash
wget https://phpdoc.org/phpDocumentor.phar -O /usr/local/bin/phpDocumentor
chmod +x /usr/local/bin/phpDocumentor
```

*Tip : You might need to run step four as root on some systems. That is : `sudo mv phpDocumentor.phar /usr/local/bin/phpDocumentor`*
If you'd rather not install it globally, download the `.phar` anywhere and call it
by its full path in the steps below.

## Generate Docs
## Generate the docs

If you did install `phpDocumentor` globally as specified above then you can generate class docs as follows.
Run : `composer run-php-documentor`
```bash
composer run-php-documentor
```



*Note : `composer generate docs` would only work if you installed `phpDocumentor` globally, if you did not run : `custom/path/phpDocumentor -d 'src,tests' -t docs/phpdoc` to generate docs*

*Where `custom/path/` is the location where you downloaded `phpDocumentor`*
This runs `phpDocumentor -d 'src,tests'`, using the output path from `phpdoc.xml`.
Open `docs/phpdocumentor/index.html` in a browser to view the result.
44 changes: 11 additions & 33 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,18 +52,19 @@ this code.

## Documentation

* [Class Docs](docs/phpdoc/)
* [Class structure overview](docs/ClassStructure.md)
* [Graphic domain model](docs/DomainModel/DomainModel.svg) and [description of the domain entities](docs/DomainModel/Entities.md)
* [Mailer Transports](docs/mailer-transports.md) - How to use different email providers (Gmail, Amazon SES, Mailchimp, SendGrid)
* [Asynchronous Email Sending](docs/AsyncEmailSending.md) - How to use asynchronous email sending with Symfony Messenger
* [Domain model diagram](docs/DomainModel/DomainModel.svg) and [description of the domain entities](docs/DomainModel/Entities.md)
* [Mailer transports](docs/MailerTransports.md) - configuring Gmail, Amazon SES, Mailchimp, and SendGrid
* [Asynchronous email sending](docs/AsyncEmailSending.md) - queuing email delivery with Symfony Messenger
* [Graylog integration](docs/Graylog.md) - centralized log management
* [Generating class API docs](PHPDOC.md) - regenerating the phpDocumentor output

## Running the web server

The phpList application is configured so that the built-in PHP web server can
run in development and testing mode, while Apache can run in production mode.

Please first set the database credentials in `config/parameters.yml`.
Please first set the database credentials in `.env` (created from `.env.dist` on `composer install`/`composer update`).

### Development

Expand All @@ -79,12 +80,6 @@ already in use, on the next free port after 8000).

You can stop the server with CTRL + C.

#### Development and Documentation

We use `phpDocumentor` to automatically generate documentation for classes. To make this process efficient and easier, you are required to properly "document" your `classes`,`properties`, `methods` ... by annotating them with [docblocks](https://docs.phpdoc.org/latest/guide/guides/docblocks.html).

More about generating docs in [PHPDOC.md](PHPDOC.md)

### Testing

Create test db with name phplist in your mysql DB or uncomment sqlite part in config_test.yml file to use in memory DB for functional tests.
Expand Down Expand Up @@ -200,31 +195,14 @@ To access the phpList data from a third-party application (i.e., not from a
phpList module), please use the
[REST API](https://github.com/phpList/rest-api).

## Email Configuration

phpList supports multiple email transport providers through Symfony Mailer. The following transports are included:

* Gmail
* Amazon SES
* Mailchimp Transactional (Mandrill)
* SendGrid

For detailed configuration instructions, see the [Mailer Transports documentation](docs/mailer-transports.md).

## Copyright

phpList is copyright (C) 2000-2025 [phpList Ltd](https://www.phplist.com/).

## Translations

### Translations
command to extract translation strings
To extract translation strings from the source into an XLIFF catalog:

```bash
php bin/console translation:extract --force en --format=xlf
```

```bash
vendor/bin/phpstan analyse -c phpstan.neon;
vendor/bin/phpmd src/ text config/PHPMD/rules.xml;
vendor/bin/phpcs --standard=config/PhpCodeSniffer/ --ignore=*/Migrations/* bin/ src/ tests/ public/;
```
## Copyright

phpList is copyright (C) 2000-2025 [phpList Ltd](https://www.phplist.com/).
6 changes: 4 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,9 @@
"ext-fileinfo": "*",
"setasign/fpdf": "^1.8",
"phpdocumentor/reflection-docblock": "^5.2",
"guzzlehttp/guzzle": "^7.4.5"
"guzzlehttp/guzzle": "^7.4.5",
"symfony/dotenv": "^6.4",
"symfony/doctrine-messenger": "^6.4"
},
"require-dev": {
"phpunit/phpunit": "^9.5",
Expand Down Expand Up @@ -127,7 +129,7 @@
"PhpList\\Core\\Composer\\ScriptHandler::createGeneralConfiguration",
"PhpList\\Core\\Composer\\ScriptHandler::createBundleConfiguration",
"PhpList\\Core\\Composer\\ScriptHandler::createRoutesConfiguration",
"PhpList\\Core\\Composer\\ScriptHandler::createParametersConfiguration",
"PhpList\\Core\\Composer\\ScriptHandler::createDotenvConfiguration",
"php bin/console cache:clear",
"php bin/console cache:warmup"
],
Expand Down
9 changes: 6 additions & 3 deletions config/config_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,12 @@ framework:

doctrine:
dbal:
# driver: 'pdo_sqlite'
# memory: true
driver: 'pdo_mysql'
# Defaults to pdo_mysql via PHPLIST_DATABASE_DRIVER (see .env). To run tests against an
# in-memory SQLite database instead (no MySQL server needed), set in .env.test.local:
# PHPLIST_DATABASE_DRIVER=pdo_sqlite
# PHPLIST_DATABASE_PATH=:memory:
driver: '%database_driver%'
path: '%database_path%'
host: '%database_host%'
port: '%database_port%'
dbname: 'phplist'
Expand Down
9 changes: 4 additions & 5 deletions config/packages/messenger.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
# This file is the Symfony Messenger configuration for asynchronous processing
framework:
messenger:
# Uncomment this (and the failed transport below) to send failed messages to this transport for later handling.
# failure_transport: failed
failure_transport: failed

transports:
# https://symfony.com/doc/current/messenger.html#transport-configuration
Expand All @@ -20,15 +19,15 @@ framework:
multiplier: 2
max_delay: 0

# failed: 'doctrine://default?queue_name=failed'
failed: 'doctrine://default?queue_name=failed'

routing:
# Route your messages to the transports
'PhpList\Core\Domain\Messaging\Message\AsyncEmailMessage': async_email
'PhpList\Core\Domain\Messaging\Message\SubscriberConfirmationMessage': async_email
'PhpList\Core\Domain\Messaging\Message\SubscriptionConfirmationMessage': async_email
'PhpList\Core\Domain\Messaging\Message\PasswordResetMessage': async_email
'PhpList\Core\Domain\Messaging\Message\CampaignProcessorMessage': async_email
'PhpList\Core\Domain\Messaging\Message\SyncCampaignProcessorMessage': sync
'PhpList\Core\Domain\Messaging\Message\CampaignProcessor\CampaignProcessorMessage': async_email
'PhpList\Core\Domain\Messaging\Message\CampaignProcessor\SyncCampaignProcessorMessage': sync
'PhpList\Core\Domain\Subscription\Message\DynamicTableMessage': sync

Loading
Loading