Creating our first hello world module
While theory is interesting, we can discover more by actually coding our whhelloword
module. A practical example is better than thousands of explanations!
In the /modules/whhelloworld/whhelloworld.php
file, let’s define the module class:
- The first mandatory point is that the module class must use the technical name. But as PHP class names often start with a capital letter, the class name can use a camelcased version of the technical name with a capital letter for the second one. The camelcased version often improves the meaning of objects’ names.
We will create the WHHelloWorld
class for our module.
- The second mandatory point is that this module class must extend the
Module
class or one of its child classes. AsPaymentModule
andCarrierModule
are both child classes ofModule
, our module could extend one of them too.
Taking into account these constraints, let’s declare our Module
class. It should...