This module is the core of phpList 4

Related tags

Email core
Overview

phpList core module

Build Status Latest Stable Version Total Downloads Latest Unstable Version License

About phpList

phpList is an open source newsletter manager. This project is a rewrite of the original phpList.

About this package

This is the core module of the successor to phpList 3. It will have the following responsibilities:

  • provide access to the DB via Doctrine models and repositories (and raw SQL for performance-critical parts that do not need the models)
  • routing (which the web frontend and REST API will use)
  • authentication (which the web frontend and REST API will use)
  • logging
  • a script for tasks to be called from the command line (or a cron job)
  • tasks to create and update the DB schema

Please note that this module does not provide a web frontend or a REST API. There are the separate modules phpList/web-frontend and phpList/rest-api for these tasks.

This module should not be modified locally. It should be updated via Composer.

Installation

Please install this package via Composer from within the phpList base distribution, which also has more detailed installation instructions in the README.

Contributing to this package

Please read the contribution guide on how to contribute and how to run the unit tests and style checks locally.

Code of Conduct

This project adheres to a Contributor Code of Conduct. By participating in this project and its community, you are expected to uphold this code.

Structure

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.

Development

For running the application in development mode using the built-in PHP server, use this command:

bin/console server:run -d public/

The server will then listen on http://127.0.0.1:8000 (or, if port 8000 is already in use, on the next free port after 8000).

You can stop the server with CTRL + C.

Testing

To run the server in testing mode (which normally will only be needed for the automated tests, provide the --env option:

bin/console server:run -d public/ --env=test

Production

For documentation on running the application in production mode using Apache, please see the phpList base distribution README.

Changing the database schema

Any changes to the database schema must always be done both in phpList 3 and later versions so that both versions always have the same schema.

For changing the database schema, please edit resources/Database/Schema.sql and adapt the corresponding domain model classes and repository classes accordingly.

Developing phpList modules (plugins)

In phpList, plugins are called modules. They are Composer packages which have the type phplist-module.

Bundle and route configuration

If your module provides any Symfony bundles, the bundle class names need to be listed in the extra section of the module's composer.json like this:

"extra": {
    "phplist/core": {
        "bundles": [
            "Symfony\\Bundle\\FrameworkBundle\\FrameworkBundle",
            "PhpList\\Core\\EmptyStartPageBundle\\PhpListEmptyStartPageBundle"
        ]
    }
}

Please note that the key of the section with extra needs to always be phplist/core, not the name of your module package. Please have a look at the composer.json in the rest-api module for an example.

Similarly, if your module provides any routes, those also need to be listed in the extra section of the module's composer.json like this:

"extra": {
    "phplist/core": {
        "routes": {
            "homepage": {
                "resource": "@PhpListEmptyStartPageBundle/Controller/",
                "type": "annotation"
            }
        }
    }
}

You can also provide system configuration for your module:

"extra": {
    "phplist/core": {
        "configuration": {
            "framework": {
                "templating": {
                    "engines": [
                        "twig"
                    ]
                }
            }
        }
    }
}

It is recommended to define the routes using annotations in the controller classes so that the route configuration in the composer.json is minimal.

Accessing the database

For accessing the phpList database tables from a module, please use the Doctrine model and repository classes stored in src/Domain/ in the phplist/core package (this package).

For accessing a repository, please have it injected via dependency injection. Please do not get the repository directly from the entity manager as this would skip dependency injection for that repository, causing those methods to break that rely on other services having been injected.

Currently, only a few database tables are mapped as models/repositories. If you need a mode or a repository method that still is missing, please submit a pull request or file an issue.

Accessing the phpList data from third-party applications

To access the phpList data from a third-party application (i.e., not from a phpList module), please use the REST API.

Copyright

phpList is copyright (C) 2000-2019 phpList Ltd.

Comments
  • [BLUEPRINT] Module registration

    [BLUEPRINT] Module registration

    This is the plan for how module registration for phpList 4 should work. Comments and feedback welcome.

    Principles

    • All phpList modules are Composer packages that are recognized by the package type phplist-module defined in the composer.json.
    • A phpList module package must only contain code, assets and configuration related to this package. The module-related files must also not be "piggy-backing" in some other package. Packages still can depend on other packages and make use of their code, though (by adding them to the require section of the composer.json).
    • From the view of the administrator/user, a module is installed by requiring it in the root package composer.json and then running a composer update. It will not be possible for a package to be in an "installed, but not activated" state.
    • It must be possible to test module packages on their own, i.e., without the base-distribution package, both with automated tests as well as manual tests. (The module package usually will depend on at least the phplist4-core package, though.)
    • Modules that provide the same capabilities (e.g., the same routes) can be configured via their composer.json to conflict with each (or more specifically: with other packages that provide the same capabilities) (TODO: document how to do this)

    Technical approach

    • For the installed application, each bundle can bring its own configuration that will be auto-included once the bundle is included.
    • There will be an application-wide configuration file that lists all module-provided bundles (i.e., their class names).
    • Each module package must provide the class names of its provided bundles in the extra section of its composer.json.
    • The phplist4-core package will provide a composer script that lists all installed modules (i.e., all installed composer packages that have the corresponding type). (The core might need to read vendor/composer/installed.json for this. I'll need to check this.) This script will be there mainly for convenience, and also to keep the PRs relatively small. This script will also be accessible via a bin/console command.
    • The phplist4-core package will provide a composer script that runs through all installed module packages, reads their composer.json file, and generates the root application bundle classes file. This script will listen to the update and install events of all phplist 4 packages (including the core). It will also listen to the package creation event of the base-distribution package. (NB: Scripts will always only be executed for the current root package, not for any dependencies.)
    • The "empty start page" will be moved to a separate module package (for which we still need to find a good name). This package will be included by default in the base-distribution package (as long as the web-frontend package does not provide any usable content). This package will conflict with the web-frontend package as both provide the / route (i.e., the root route). This package will also be used by the automated tests for module registration in the phplist4-core package.

    (Planned) Pull requests

    • [x] #153 Add a function for provided the path to the application root.
    • [x] #155, #156 Add a composer script that lists all installed module packages to the phplist4-core package. This will include a PHP class for this that can also be used for other things.
    • [x] #157 Add the not-yet-autogenerated bundles classes configuration file to the phplist4-core package, move the REST API configuration and the "empty start page" configuration there, and add it to Git. (At this stage, the phplist4-core still has hard-coded references to the rest-api package.) (This config file will be removed once auto-generation of the config file is added.)
    • [x] #158 Add the script that auto-generates the root configuration file to the phplist4-core package and delete the old manual configuration file. Add composer listeners for update and install to the phplist4-core package and add the file to the .gitignore.
    • [x] Change the "empty start page" bundle to auto-include its configuration.
    • [x] For all module packages and the base-distribution package, add composer listeners for update and install to the phplist4-core package and add the file to the .gitignore.
    • [x] #168 Add a script that auto-generates a routes configuration file.
    • [x] https://github.com/phpList/rest-api/pull/40 Add the configuration file to the rest-api package.
    • [x] #183 Clean up the code for the empty start page in the phplist4-core package.
    • [x] #179, #205, #207 Use dependency injection.
    • [x] #203 Allow modules to provide their own (non-service) configuration
    • [x] Use the FOSRestBundle for our REST module.
    enhancement meta 
    opened by oliverklee 14
  • Define a coding style.

    Define a coding style.

    We have to define a coding style. This will provide a clean and uniform workflow. Code review will be easier.

    http://www.php-fig.org/psr/psr-1/ http://www.php-fig.org/psr/psr-2/

    Useful links but we can define our custom coding style.

    opened by tarekdj 13
  • [FEATURE] Domain model documentation

    [FEATURE] Domain model documentation

    This is a domain model in the domain-driven-design sense (i.e., mostly a UML class diagram). It'd not an ER diagram. The model names usually are similar to the corresponding DB table names, but are technically independent.

    The graphical domain model is best viewed by using the generated SVG and then using GitHub's "View" button.

    @samtuke @michield I'd appreciate feedback on these questions:

    • Do the domain contexts make sense? Are the context names perfect? Are the entities in the correct context? Should we have any more contexts? Which ones?
    • Are the associations correct?
    • Are the directions of the associations correct?
    • Are the descriptions of the domain models (in the markdown file) correct? Is anything missing, or could anything be improved?
    • Comments on my "what is this, and what does it do" questions. :-)
    • For which m:n associations should we have dedicated named association models? (We probably need dedicated association models for those models that have properties.)
    • Which * must actually be 1..n?
    • Which entities are not in use anymore and can be ignored (and should be removed for phpList 3)?
    discussion waiting for feedback documentation 
    opened by oliverklee 12
  • Provide migration instead of being backwards compatible

    Provide migration instead of being backwards compatible

    I know this is quite a huge deal for Michiel and maybe for others, but I think it will be confusing when not changing the database at all. Now that messages have become campaigns and users have become subscribers, it would make a lot of sense to change the naming in the database as well. It will be confusing to put subscribers in the users database and do queries referencing user_ids etc.

    I would even want to suggest another change, not to use mailing-lists anymore, but switch over to a more general filter system (so mailing lists can be compared to user attributes). We can have categories of filters like:

    • Mailing lists
      • News
      • Development
    • Favorite color
      • Red
      • Green And use regular attributes as filters as well
    • Name
    • State
    • Country
    • ...

    The GUI could easily split this up and still pretend like we use lists, but it might be easier to build a general filter for which subscribers need to receive a given campaign.

    discussion 
    opened by SaWey 11
  • [TASK] Drop support for PHP < 5.6

    [TASK] Drop support for PHP < 5.6

    PHP 5.4 and PHP 5.5 have reached their end of life and thus are not supported anymore (not even with security updates). So PHPList will not support it anymore, either.

    opened by oliverklee 9
  • [FEATURE] Add and import the database schema

    [FEATURE] Add and import the database schema

    Now Travis import the database schema before each build.

    The database schema has been taken from the development demo database (but without the data).

    enhancement 
    opened by oliverklee 5
  • "phone home" issues and security

    The existing version 3 of phplist has a somehow worrying issue. It "phones home" via several methods that can't be disabled via a config option.

    The one that worries me most is the rss feed on the dashboard, which is a security risk. In the past, we've seen some serious exploits in the unserialize() function of PHP. Unfortunately, the rss on the phplist dashboard uses exactly that, to load remote memory arrays directly to the PHP interpreter.

    This can be exploited by someone first getting access to the remote phplist server, or by using a man-in-the-middle attack (like DNS injection) to send a malicious string to thousands of phplist installations.

    Since version 4 is still in development, I propose a few quick solutions to avoid any potential security issues in the future:

    • Add a config parameter to disable the rss calls on the dashboard.
    • Stop using unserialize(), instead use a proper XML or JSON reply from the phplist server and add some checks and limits on the strings contained within that reply.
    • Verify the remote reply via secure keys or similar method, to make sure the reply is being generated by the phplist server.

    Please let me know what you think about the issue.

    Thank you.

    opened by ghost 5
  • [Meta] Build core component classes

    [Meta] Build core component classes

    • [ ] Admin Class (which is not User Class).
    • [ ] Subscriber Class
    • [ ] List/Campaign Class
    • [ ] ...

    Up to us to decide on which components we will keep on core.

    discussion 
    opened by tarekdj 5
  • Project Structure Proposal

    Project Structure Proposal

    Namespace Refactoring

    Currently we include version in our namespace:

    namespace PhpList\PhpList4\Core
    

    I think we will have trouble when relasing a next major version for example 5.0.0. Contributor will get confused whether the same class can be used or not in 5.0.0 version. Please take a look at symfony. Symfony have a different version from 2.0 to 4.0. Some components act differently in each version. To make maintenance easier we don't see any version included on symfony namespace.

    We can use git branch feature to maintenance spesific version of phplist, so we don't have to stick a namespace into a spesific namespace. For example:

    • branch 3.0: for phplist version 3.0 (yes, we can even use same git repository to maintenance 3.0 version)
    • branch 4.0: for phplist version 4.0

    Thanks to psr4 autoloading. This namespace will create an unnecessary sub directory in psr0 autoload:

    // path/to/phplist4-core
    src/
    ----- PhpList
    ----------- PhpList4
    ------------------ Core
    

    I suggest we just use a more simple also a more common practice used by an opensource project:

    namespace PHPList\Core;
    

    I know this refactoring can produce a lot of error. With find and replace (php editor feature), and phpunit tests to detect any error; I think we can refactor namespace easily.

    Testing Configuration

    1. phpunit.xml.dist File

    By default phpunit will search phpunit.xml in the current working directory (path/to/phplist4-core), if this file is not exists then phpunit try to find default configuration file which is phpunit.xml.dist. I think it's more simple to just use phpunit without having to pass --configuration in command:

    # path/to/phplist4-core
    
    ./vendor/bin/phpunit
    # command above is more simple then:
    ./vendor/bin/phpunit  -c Configuration/PHPUnit/phpunit.xml
    
    

    So I suggest we need to put our configuration file in path/to/phplist4-core/phpunit.xml.dist, and git ignore the path/to/phplist4-core/phpunit.xml file because it should be a custom configuration for every developer.

    2. Testing Configuration

    We should separate testing configuration from project configuration. so we need to move all tests configuration from Configuration directory to tests/config.

    Directory Naming Conventions

    I suggest that we use lowercase for non namespace directory. So when we see Configuration directory we will know that it will contain a class, while config dir only contain a configuration file. Here's my sugestion:

    • tests directory: Since there are no namespace called Integration, Support, and Unit, we just use lowercase name for this directories
    • Configuration directory: we just use simply use config because it is a common name used by symfony based project to store configuration files.
    • Database directory: we need to rename this directory to data.

    Here's what I hope phplist4-core project directory like:

    
    path/to/phplist4-core
    ├── config
    │   ├── config.yml
    │   └── # other config files...
    ├── data
    │   ├── phplist-db.mwb
    │   └── Schema.sql
    ├── src
    │   ├── Core
    │   ├── Routing
    │   └── System
    └── tests
        ├── config
        │   ├── code-sniffer-ruleset.xml
        │   ├── phpmd-ruleset.xml
        │   └── phpunit-travis.xml
        ├── integration
        │   ├── Composer
        │   └── Core
        ├── system
        └── unit
            ├── Core
            └── Domain
    
    

    Some References

    Here's some sample of good symfony based project that we can implement in phplist:

    discussion 
    opened by kilip 4
  • [BUGFIX] Load an existing config file in the unit tests

    [BUGFIX] Load an existing config file in the unit tests

    The unit tests still do not pass completely as they cannot connect to any DB on Travis yet. This will be part of a separate PR.

    (And unit tests should not connect to a real database.)

    opened by oliverklee 4
  • Symfony framework [question]

    Symfony framework [question]

    Hi!

    As soon as you are already using some Symfony2 components, why not using the Symfony2 Fullstack to bootstrap application development? I think this will make code more consistent and incapsulated i.e. with using container instead of global constants and static classes and ini config. Also it's provides essential libraries, like Doctrine2 ORM and Swiftmailer which allows you to focus on business logic and fits better to OO style of this version

    question 
    opened by scaytrase 4
  • Update Symfony

    Update Symfony

    Update symfony and affected packages.

    phpList/core currently depends on symfony 3.4.37 which is several versions behind the latest version and is not supported.

    For this to be done, phpunit/dbunit first has to be removed as mentioned in #324 as it requires various packages that have been replaced by newer versions of symfony/symfony see;

      Problem 1
        - phpunit/dbunit[3.0.2, ..., 3.0.3] require symfony/yaml ^3.0 || ^4.0 -> satisfiable by symfony/yaml[v3.0.0, ..., v3.4.47, v4.0.0, ..., v4.4.20].
        - phpunit/dbunit[3.0.0, ..., 3.0.1] require symfony/yaml ^3.0 -> satisfiable by symfony/yaml[v3.0.0, ..., v3.4.47].
        - Only one of these can be installed: symfony/yaml[v3.0.0, ..., v3.4.47, v4.0.0, ..., v4.4.20], symfony/symfony[v5.2.5]. symfony/symfony replaces symfony/yaml and thus cannot coexist with it.
        - Root composer.json requires symfony/symfony ^5.2.5 -> satisfiable by symfony/symfony[v5.2.5].
        - Root composer.json requires phpunit/dbunit ^3.0.0 -> satisfiable by phpunit/dbunit[3.0.0, 3.0.1, 3.0.2, 3.0.3].
    
    enhancement blocked help wanted 
    opened by Fenn-CS 0
  • Removing PHPUnit/DbUnit

    Removing PHPUnit/DbUnit

    DBUnit abandoned

    PHPUnit/DBUnit has been abandoned, as a result no longer maintained, it has apparently become less useful over time as explained by its maintainers in the new maintainer request "New Maintainer #217".

    Test cases have to now be rewritten without using the dbunit

    cleanup help wanted 
    opened by Fenn-CS 0
  • Update all packages to latest possible versions to enable full php8 support.

    Update all packages to latest possible versions to enable full php8 support.

    Description

    Currently dependencies cannot resolve non-conflicting installable versions on php8.0. Failing build commands are marked with continue-on-error: ${{matrix.php-versions == '8.0' }} # [temp-php8] to ignore php8.0 errors in the .github/workflows/ci.yml. It's the required to also ignore build errors on php8.0 for phpList/rest-api which depends on phpList/core.

    Once we are fully able to support php8.0 on core, build error for php8.0 ignored in phpList/rest-api may no longer be ignored.

    help wanted 
    opened by Fenn-CS 0
  • Keep development files out of the Composer packages

    Keep development files out of the Composer packages

    To reduce download size, we should have a .gitattributes file that makes sure that development-only files (tests, CI stuff and non-production configuration) will not end up in the Composer packages and the ZIPs generated by GitHub.

    Like this: https://github.com/MyIntervals/emogrifier/commit/80266bb671b4aab6c8d496230546b902ec0d3e1a#diff-fc723d30b02a4cca7a534518111c1a66

    opened by oliverklee 0
  • [BUGFIX] Fix SubscriberList to Subscriber relationship definition by …

    [BUGFIX] Fix SubscriberList to Subscriber relationship definition by …

    opened by bizmate 6
  • Schema validation errors

    Schema validation errors

    Short problem description

    Entities define a schema that is invalid according to doctrine schema validation tool. As a result the schema cannot be created

    Steps to reproduce

    1. bin/console doctrine:schema:validate
    2. shows validation errors
    [Mapping]  FAIL - The entity-class 'PhpList\Core\Domain\Model\Messaging\SubscriberList' mapping is invalid:
    * The field PhpList\Core\Domain\Model\Messaging\SubscriberList#subscribers is on the owning side of a bi-directional relationship, but the specified mappedBy association on the target-entity PhpList\Core\Domain\Model\Subscription\Subscriber# does not contain the required 'inversedBy' attribute.
    
    [Mapping]  FAIL - The entity-class 'PhpList\Core\Domain\Model\Subscription\Subscriber' mapping is invalid:
    * The field PhpList\Core\Domain\Model\Subscription\Subscriber#subscribedLists is on the owning side of a bi-directional relationship, but the specified mappedBy association on the target-entity PhpList\Core\Domain\Model\Messaging\SubscriberList# does not contain the required 'inversedBy' attribute.
    
    
    In SchemaException.php line 109:
                                                                      
      The table with name 'phplist.phplist_listuser' already exists.  
    
    
    1. As a result also the schema cannot be generated

    Expected behaviour

    no errors when running bin/console doctrine:schema:create and a consistent db structure as a result

    Actual behaviour

    As per description in steps

    System configuration

    docker, php7.2, mysql 5.7 Extra info at https://github.com/bizmate/phplist-benchmark

    Package version

    dev-master tried both hashes 9f890f2 and d4dc77b

    PHP and Composer version

    php - php7.2 ( https://github.com/bizmate/phplist-benchmark/blob/master/docker/php/Dockerfile#L1 ) Composer version 1.9.3 2020-02-04 12:58:49

    bug 
    opened by bizmate 0
Releases(v4.0.0-alpha5)
Owner
phpList
phpList and related projects
phpList
Laravel IMAP is an easy way to integrate both the native php-imap module and an extended custom imap protocol into your Laravel app.

Laravel IMAP is an easy way to integrate both the native php-imap module and an extended custom imap protocol into your Laravel app. This enables your app to not only respond to new emails but also allows it to read and parse existing mails and much more.

null 530 Jan 6, 2023
Magento 2 Email Catcher or Email Logger Module.

Magento 2 Module Experius email catcher / - logger

Experius 49 Dec 16, 2021
SlmMail is a module that integrates with various third-parties API to send mails. Integration is provided with the API of those services

SlmMail is a module that integrates with various third-parties API to send mails. Integration is provided with the API of those services

Webador 107 Dec 14, 2022
The spatial web mapping framework and core-module

Mapbender module This is the Mapbender module, the main-component of the Mapbender application. This module works like a library and can not run for i

Mapbender Development Team 74 Dec 25, 2022
Magento 2 Module Experius Page Not Found 404. This module saves all 404 url to a database table

Magento 2 Module Experius Page Not Found 404 This module saves all 404 urls to a database table. Adds an admin grid with 404s It includes a count so y

Experius 28 Dec 9, 2022
The Laravel eCommerce DHL Shipping module module calculates the shipping rates based on DHL API for product shipping.

Introduction DHL Shipping Add-on provides DHL Shipping methods for shipping the product. It packs in lots of demanding features that allows your busin

Bagisto 1 May 31, 2022
The OWASP ZAP core project

OWASP ZAP The OWASP Zed Attack Proxy (ZAP) is one of the world’s most popular free security tools and is actively maintained by a dedicated internatio

OWASP ZAP 10.3k Jan 5, 2023
This package extends the core file generators that are included with Laravel 5

Extended Migration Generators for Laravel 6, 7 and 8 Easily define the migration schema right in your make:migration command. The new commands this pa

Laracasts 2.4k Dec 29, 2022
FacEssential is a Core for PMMP, it gathers all kind of plugins needed to create a faction server. It was created from scratch by Clouds#0667.

FacEssential FacEssential is a Core for PMMP, it gathers all kind of plugins needed to create a faction server. It was created from scratch by Clouds#

Zoumi 10 Jun 13, 2022
Eine Feature Reiche Core aus Verschiedenen Plugins und Eigenkreation.

CoreV5 ALPHA Du willst helfen? Hier mein Discord! Download und Wichtig Hier downloaden! Das Core Plugin wurde speziell für CityBuild Server entwickelt

TheNote 15 Sep 24, 2022
Project template for developing Drupal core with a git clone.

Drupal Core Development Composer Project This is a Composer project template for developing Drupal core. It allows: a clean git clone of Drupal core.

Joachim 22 Dec 2, 2022
📦 This is a repository of centralized management of all swoft core components

Swoft Component This repository is used to manage all swoft core components. 中文说明 中文说明请查看 README.zh-CN.md IMPORTANT All components will NOT be modifie

Swoft Cloud 95 Nov 16, 2022
Core framework that implements the functionality of the Sulu content management system

Sulu is a highly extensible open-source PHP content management system based on the Symfony framework. Sulu is developed to deliver robust multi-lingua

Sulu CMS 921 Dec 28, 2022
This repository contains the sources of OXID eShop Community Edition Core Component.

OXID eShop This repository contains the sources of OXID eShop Community Edition Core Component. About OXID eShop: OXID eShop is a flexible open source

OXID eSales AG 209 Dec 14, 2022
Performance fixes for magento 2 core.

magento2-performance-fixes Performance fixes for magento 2 core. Problem and solution's concept - briefly PHP / Magento doesn't support concurency req

Mariusz Łopuch 48 Dec 30, 2022
A drop in replacement for Symphony CMS to upgrade core and selected extensions to PHP 8.0 compatibility

PHP 8 Upgrade Instructions These are the files I have used to upgrade existing Symphony CMS installs to PHP 8.0 compatibility. As always, make sure yo

Phill 3 May 25, 2022
Minimalist PHP frame for Core-Library, for Developing PHP application that gives you the full control of your application.

LazyPHP lightweight Pre-Made Frame for Core-library Install Run the below command in your terminal $ composer create-project ryzen/lazyphp my-first-pr

Ry-Zen 7 Aug 21, 2022
Subscriptions core package for WooCommerce

WooCommerce Subscriptions Core This package adds core subscriptions functionality to your WooCommerce store. Dependencies WooCommerce WooCommerce Subs

Automattic 43 Dec 20, 2022
Improve Core Web Vital score for Magento 2 website

Magento 2 Optimization for Google Insights This modules allows you modify the HTML, Javascript, CSS, update the position, optimize CWV (Core Web Vital

Hoang hieu 9 Oct 25, 2022