PHP code example of pisc / shopware-plugin-helpers
1. Go to this page and download the library: Download pisc/shopware-plugin-helpers library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
pisc / shopware-plugin-helpers example snippets
public function install()
{
$this->subscribeEvent('Enlight_Controller_Front_DispatchLoopStartup', 'onStartDispatch');
}
public function onStartDispatch(Enlight_Event_EventArgs $args)
{
$this->registerMyComponents();
$subscribers = [
new Shopware\Plugins\SwagSloganOfTheDay\MySubscriber;
];
foreach ($subscribers as $subscriber) {
$this->Application()->Events()->addSubscriber($subscriber);
}
}
public function registerMyComponents()
{
// instead of:
// $this->Application()->Loader()->registerNamespace(
// 'Shopware\Plugins\SwagSloganOfTheDay',
// $this->Path() . "/src"
// );
//