PHP code example of mage2kishan / module-core

1. Go to this page and download the library: Download mage2kishan/module-core 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/ */

    

mage2kishan / module-core example snippets


use Panth\Core\Helper\Theme;

class MyBlock extends \Magento\Framework\View\Element\Template
{
    public function __construct(
        Context $context,
        private readonly Theme $themeHelper,
        array $data = []
    ) {
        parent::__construct($context, $data);
    }

    public function isHyvaActive(): bool
    {
        return $this->themeHelper->isHyva();
    }

    public function isLumaActive(): bool
    {
        return $this->themeHelper->isLuma();
    }

    public function getCurrentThemeType(): string
    {
        // Returns 'hyva' or 'luma'
        return $this->themeHelper->getCurrentTheme();
    }
}

// In template.phtml
$viewModel = $block->getViewModel();
$primary = $viewModel->getColor('primary');
$radius = $viewModel->getRadius('default');

use Panth\Core\Api\ThemeBuildExecutorInterface;

class MyController
{
    public function __construct(
        private readonly ThemeBuildExecutorInterface $themeBuilder
    ) {}

    public function execute()
    {
        $result = $this->themeBuilder->build();
        // $result['success'], $result['message'], $result['output']
    }
}
xml
<config>
    <module name="Panth_AdvancedSEO" version="1.0.0">
        <label>Advanced SEO</label>
        <description>Enterprise-grade SEO suite</description>
        <admin_url>panth_seo/dashboard/index</admin_url>
    </module>
</config>