MarmiAds Prestashop module
- PHP 5.4+
- Prestashop 1.6+
-
There are no unit tests: Prestashop 1.6 developers did not think about module testing. Furthermore it heavily uses the singleton design pattern.
-
No composer and autoload: There are 2 reasons why composer is not used:
- The module has no external dependencies
- Prestashop 1.6 does not use namespaces, using them in this simple module (it would only be possible use namespaces in 2 files) is not appropriate. For modules with more classes it is better to use namespaces and configure psr-4 autoload in composer.
-
Performance: In development, readability and simplicity have been preferred over performance. If it were necessary to obtain less response time, they could be improved a lot, but we would have a more complex and difficult to maintain code.
-
Router: Prestashop 1.6 does not allow advanced routes, only a name, for example
/module/marmiads/feed
but not/module/marmiads/feed/products
. To allow routes like/feed/products
I have decided to include the route in aGET
parameter, so that thebase_url
would be:http://example.com/module/marmiads/endpoint?action=
-
Coding Standard: I use PSR1 and PSR2 to follow standards. You can check if the code style is correct with the cs-fixer tool:
docker run --rm \ --user $(id -u):$(id -g) \ --volume $(pwd):/data \ cytopia/php-cs-fixer fix --dry-run --diff .
-
CI: At the moment only code style checks have been included using Github Actions