element
Helpers
Helpers can be used for 'normal' php functions outside of the scope of the framework. For example, we can use them to create base classes
They should have a suffix of 'Helper' and should be placed in the Helpers directory.
Example Helper
<?php
namespace element\mvc;
class BaseHelper{
protected $sherlock;
protected $watson;
}
Extend Helper
<?php
namespace element\mvc;
class ElementaryHelper extends BaseHelper{
public function __construct() {
$this->watson = "Doctor";
$this->sherlock = "Detective";
}
}
<?php
namespace element\mvc;
class BaseHelper{
protected $sherlock;
protected $watson;
}
Extend Helper
<?php
namespace element\mvc;
class ElementaryHelper extends BaseHelper{
public function __construct() {
$this->watson = "Doctor";
$this->sherlock = "Detective";
}
}
<?php
namespace element\mvc;
class ElementaryHelper extends BaseHelper{
public function __construct() {
$this->watson = "Doctor";
$this->sherlock = "Detective";
}
}