@halfdan opened this Issue on February 7th 2013 Member

This ticket should serve as a placeholder ticket for discussion and future changes related to Piwik 2.0.

With Piwik 2.0 in sight we should raise the minimum PHP version to 5.3. PHP 5.1 has EOL'd more than 7 years ago, and PHP 5.2 more than 2 years ago. [[http://php.net/eol.php]]

PHP 5.3 introduced several interesting features that we can utilize.


For Piwik 2.0 I propose the following changes regarding namespaces.

We use \Piwik as central namespace. Everything else will go into subnamespaces. This will allow us to get rid of long class names like Piwik_Plugin_Config (which will become the class Config in the namespace \Piwik\Core\Plugin.

I propose the following namespaces:


and so on. We should discuss if the "Core" namespace is necessary however.


PHP 5.3 also introduced anonymous functions, which we can use as callback methods in some places.

It also introduced better XML support with XMLReader/XMLWriter, which could act as a replacement for SimpleXML and solve #1522.

This will break backwards compatibility, but since 2.0 is a major release we should use this to bring Piwik to the latest standard in PHP development.

This will also allow us to upgrade or change some of our dependencies that have moved to PHP 5.3 as well.

Bringing Piwik to PHP 5.3 is no easy task and will very likely be a joint effort. We need to decide on a feature freeze date. At this date, no new features will be implemented in the master branch. We will then create a "Piwik 1.x" branch which we can maintain for security patches and backports of Piwik 2.0 features. The master branch will then be used to upgrade Piwik to PHP 5.3.

Feel free to add to this ticket!

@sgiehl commented on February 7th 2013 Member

Have you already looked at ZF2? It is not really a new version of zend framework (1). It's more like a complete new framework. I don't think its even possible to upgrade without rewriting everything.

If we realy want to switch to PHP 5.3 features and a new framework, maybe we should also have a look at symphony (http://symfony.com/) and start completly new. That way we would have a clean new code base and could directly implement some features that are very hard to implement with the current code base.

Note: PHPUnit 3.8 requires PHP 5.4.7 (or later).

@halfdan commented on February 7th 2013 Member

No I haven't looked at ZF2 very close. I did not think that the changes were that big.

Symfony would be very interesting indeed as it would allow us to clean up the code base quite a bit. Templating also seems to be much easier in Symfony as compared to Smarty.

I think the first step is to bring Piwik to 5.3. After that we can consider changing the framework.

@julienmoumne commented on February 7th 2013 Member

+1 for namespaces
+1 for anonymous functions (I would then be able to simplify https://github.com/piwik/piwik/blob/1.9.2/plugins/MobileMessaging/ReportRenderer/Sms.php#L74)

@mattab commented on March 11th 2013 Member

Regarding \Core namespace: IMHO it adds clutter so better leave it out.

@mattab commented on July 30th 2013 Member

In 765be0dc8f92a6d4bb3e678a0c23f2d4b95e0e18: Refs #3741 Resuming PHP Namespaces conversion of Piwik core, mostly finished core/ conversion

@mattab commented on July 31st 2013 Member

In 11752942f0e6526a0d254af2bb2b101491238f29: Refs #3741 PHP Namespace conversion continued: Tracker classes,
renaming Unzip to Uncompress,
Renaming Tracker/Referer to Tracker/Referrer,
and few more

@sgiehl commented on July 31st 2013 Member

In 9c12ab4812459b9d9144c65bd0cc9b83d27b6581: refs #3741 fixing some namespaces

@mattab commented on August 9th 2013 Member

In 32fe6810d7db72f292bc5f867d117c1bc0ae4a92: Piwik now requires PHP 5.3 Fixes #3741

@mattab commented on August 9th 2013 Member

In 215fdbead801feec2d9a8ea2c404c1ff234b1ac6: Refs #3741 Removing pre 5.3 compatibility code

@mattab commented on August 9th 2013 Member

namespaces covered in #4059

@anonymous-matomo-user commented on September 3rd 2013

In 3f7a6795f1c61076bbd70720c5950fabf9bcddde: Remove compat code for PHP < 5.3. inet_pton/inet_ntop are available in Windows in PHP >= 5.3 so we don't need the compat code anymore.

refs #3741, #4113

This Issue was closed on October 16th 2013
Powered by GitHub Issue Mirror