PHP code example of jalendport / craft-base

1. Go to this page and download the library: Download jalendport/craft-base 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/ */

    

jalendport / craft-base example snippets


use jalendport\base\Plugin;

class Altcha extends Plugin
{
    public static Altcha $plugin;

    public function init(): void
    {
        parent::init(); // registers the log target, @altcha alias, shared template root
        self::$plugin = $this;

        $this->registerEventHandlers();
    }
}

protected function settingsHtml(): ?string
{
    return Craft::$app->getView()->renderTemplate('altcha/settings', [
        'settings' => $this->getSettings(),
        'overrides' => $this->getConfigOverrides(),
    ]);
}