[Work in progress] - MailWizz - 2.0

Discussion in 'Announcements' started by twisted1919, Sep 27, 2019.

  1. twisted1919

    twisted1919 Administrator Staff Member

    Joined:
    Dec 27, 2014
    Messages:
    10,436
    Likes Received:
    2,427
    Hello everyone,

    As announced in the past, we started working on MailWizz 2.0 for a while now.

    Our main concern for MailWizz 2.0 is to make it support PHP >= 7.1 only and remove any other code which does not rely on this requirement.

    We also will make sure that upgrading from MailWizz 1.x to MailWizz 2.x will be pain free, just like upgrading from any other MailWizz version, in other words all the changes we're doing should be transparent for most of the people.

    We will post the progress in this thread so that anyone that extended the application know what to expect for the upcoming big MailWizz release.

    Please remember that we will continue to support MailWizz 1.x even after the release of Mailwizz 2.x, so there's no need to worry about this for now.

    Here's the current notable changes in MailWizz 2.0 so far:
    Code:
    We now require PHP >= 7.1.13 for the app to run properly. 
    
    
    1. Most of the code is now using typed params and return types. 
      Instead of `public function abc($text, $intNum)` you'll see: `public function abc(string $text, int $intNum): string` 
      This means you have to edit any code that extends core functionality and make sure the method declarations are compatible. 
     
    2. All extension dependencies were moved in the app main composer.json file, no more specific composer.json
        for each extension which would generally cause issues and conflicts between the libraries.
       
    3. We're using composer now, so all libraries are versioned and stored in the `vendor` folder.
        The old `apps/common/vendors` folder is only used for libraries that aren't available via composer.
     
    4. We have added a set of shortcut methods for easier access for the app components. 
        Here's a small table: 
        `Yii::app()->` becomes `app()->` 
        `Yii::app()->assetManager->` becomes `assetManager()->` 
        `Yii::app()->hooks->` becomes `hooks()->` 
        `Yii::app()->urlManager->` becomes `urlManager()->` 
        `Yii::app()->request->` becomes `request()->` 
        `Yii::app()->notify->` becomes `notify()->` 
        You can look into `apps/common/components/utils/functions.php` to see all the shortcuts. 
        We recommend using these shortcuts from now on as it makes things easier to read.
       
    5. Instead of `Yii::t()` we advise using `t()`. 
    
    6. Generally we used to access the app options via `Yii::app()->options->get('category.key')` even for option categories
        that had model classes, for example, to get the site name, we would `Yii::app()->options->get('system.common.site_name')`. 
        We added getters for most of the option models properties, so we advise
        using things like `(new OptionCommon())->getSiteName()` instead. 
        If the option isn't part of a model, you can access it with `options()->get('category.key')`. 
       
    7. Application params used to be accessed via `Yii::app()->params['some.param']`. 
        We advise using the `app_param('some.param', 'defaultValueOptional')` instead. 
        There's also `app_param_set($key, $value)` to set a param and also
        `app_param_unset($key)` to unset a param. 
       
    8. Since we're using types params for methods/functions, if a method signature accepts strings,
        make sure you pass strings to it, if it accepts ints, pass it ints, and so on. 
        Use type casting if needed, i.e: `$this->abc((string)$text, (int)$num)` 
       
    9. CSV parsing will only be done using `league/csv`, see https://csv.thephpleague.com/ 
    
    10. Generators will be used as much as possible when loading data in batches from database, namely
        methods like `getModels()` which used to be called in a `while` loop.
       
    11. We added model collections, see `apps/common/models/collection` which return an
        instance of `\Illuminate\Support\Collection`, see https://laravel.com/docs/6.0/collections 
        Which can be used like: 
        ```php
        CampaignCollection::findAll($criteria)->mapWithKeys(function(Campaign $model) {
            return [$campaign->campaign_id => $campaign->name];
        })->all(); 
        ``` 
        This is the desired way to manipulate arrays. 
       
    12. Database charset has been changed to `utf8mb4`. 
    
    13. Handling scripts from controllers will be done via: 
        `Controller::getPageScripts`, `Controller::addPageScript`, `Controller::addPageScripts` 
       
    14. Handling styles from controllers will be done via: 
        `Controller::getPageStyles`, `Controller::addPageStyle`, `Controller::addPageStyles` 
       
    15. Unit tests were added for most of the code base. 
    
    16. Acceptance tests were added for most used routes. 
    
    17. Use `html_encode($text)` when echoing content. 
    
    18. Use short array syntax (`[1, 2, 3]`) instead of long one(`array(1, 2, 3)`).
    
    19. The `extensionMimes` component, which is an instance of `FileExtensionMimes` now uses `ralouphie/mimey`
        to load much more mimes by default, then we add our mimes over those. 
        The calls to the component remain unchanged: `app()->extensionMimes->get(['png', 'jpg', 'jpeg', 'gif'])->toArray()` 
       
    20. Removed all calls to ini_set('max_execution_time', '...') and set_time_limit() and ignore_user_abort()
    
    21. Removed PHPMailer from the app.
    
    22. Remove any attempts related to setting the memory limit of the app.
    
    23. Customer suppression list import/export has been improved and it's about ~300% faster.
    
    24. Email Blacklist import/export has been improved and it's about ~300% faster.
    
    25. Removed `AppInitHelper::makeRemoteRequest`, `AppInitHelper::simpleCurlPut`,
        `AppInitHelper::simpleCurlGet`, `AppInitHelper::simpleCurlPost` 
    
    26. All remote http calls are now made via `GuzzleHttp\Client` 
    
    27. AllListsSubscribersFilters now uses generators and collections to complete the actions
    
    We will add to the above as we progress.

    Again, please note that MailWizz 2.0 is not about new features, it is about bumping up the php version and improving the existing code so that we can then easily add more features to the app.
     
  2. morpheus93

    morpheus93 Member

    Joined:
    May 5, 2017
    Messages:
    52
    Likes Received:
    3
    S.E:
    2019-11-24 22:51:43
    L.T:
    Regular
    L.C:
    2
    Sounds like great things are coming :)
     
  3. Vpul Shah

    Vpul Shah Active Member Support Staff

    Joined:
    Feb 23, 2015
    Messages:
    765
    Likes Received:
    122
    S.E:
    2019-12-22 13:03:57
    L.T:
    Regular
    L.C:
    1
    Glad to hear Twisted.
     
  4. OHWO

    OHWO New Member

    Joined:
    Oct 6, 2019
    Messages:
    20
    Likes Received:
    6
    S.E:
    2020-04-05 10:44:39
    L.T:
    Regular
    L.C:
    1
    I know you probably don't get paid a whole lot for your updates. I really really appreciate you continuing to take care of updating. Mailwizz is so incredible. The more I test it, the more I love it.
     
    nadworks and twisted1919 like this.
  5. OptiBiz1

    OptiBiz1 Active Member

    Joined:
    Sep 28, 2015
    Messages:
    380
    Likes Received:
    123
    S.E:
    2024-09-02 01:41:15
    L.T:
    Extended
    L.C:
    21
    Still Yii 1.x ?
     
  6. twisted1919

    twisted1919 Administrator Staff Member

    Joined:
    Dec 27, 2014
    Messages:
    10,436
    Likes Received:
    2,427
    Yes, still Yii 1.x, that's a solid framework.
     
    Andy and sharif like this.
  7. frm.mwz

    frm.mwz Well-Known Member

    Joined:
    Mar 8, 2016
    Messages:
    3,711
    Likes Received:
    680
    S.E:
    2019-11-27 02:17:39
    L.T:
    Regular
    L.C:
    7
    Oh...considering PhpMailer is 2.6 times faster than SwiftMailer...this is sad "news" :(
    Any options to keep it?
     
    imeow likes this.
  8. twisted1919

    twisted1919 Administrator Staff Member

    Joined:
    Dec 27, 2014
    Messages:
    10,436
    Likes Received:
    2,427
    Unfortunately no, the PHPMailer team has taken some weird decisions like the fact we can't force the return path header anymore, etc.
    Also, it's complex to maintain two mailers, time consuming to troubleshoot issues, etc.
    It will be better with only one.
     

Share This Page