Codepower Pack is a plugin to improve the Craft coding experience. It emphasizes the use of PHP attribute annotations instead of encoding, including event register, enum assistants, and other useful tools.

What's this?

Essentially, Codepower Pack simply packages some libraries into a plugin for use directly in the Craft Store. You can directly Using these libraries, there is no need to install this plugin.

Event Register is an event register that can directly register application events in the configuration file.

<?php
// config/events.php

use craft\web\View;
use panlatent\craft\event\register\Bootstrap;
use panlatent\craft\event\register\RegisterEvent;

return [
    #[Bootstrap]
    function($app) {
        if ($app->request->getIsCpRequest()) {
            // ...
        }
    },

    #[RegisterEvent(View::class, View::EVENT_REGISTER_CP_TEMPLATE_ROOTS)]
    function(\craft\events\RegisterTemplateRootsEvent $event) {
        // ...
    },
]

Enum Helper is an enumeration assistant that automatically generates PHP enumeration classes such as Section, Field, etc., so that you can use enumeration items instead of handle strings.

<?php
// Query a section 
Section::post->find()

Form Schema declare form fields via PHP Attribute without writing Twig templates

<?php

use Panlatent\FormSchema\Forms;

class Volume extends \craft\base\Field
{
    // ...
    
    #[Forms\TextInput]
    public ?string $property1 = null;
    
    #[Forms\KeyValue]
    public array $property2 = [];
    
    // ...
}

Attribute It is a richer collection of PHP Attributes for Craft

<?php

use panlatent\craft\annotations\web\AllowAnonymous;
use panlatent\craft\annotations\web\RequiredLogin;

class UserController extends \craft\web\Controller
{

    #[AllowAnonymous]
    #[RequiredLogin]
    public function actionIndex()
    {
    
    }
}
Installation Instructions

To install this plugin, copy the command above to your terminal.

Reviews

This plugin doesn't have any reviews.

Active Installs
2
Version
0.1.0
License
MIT
Compatibility
Craft 5
Last release
March 20, 2025
Categories
Activity (30 days)
0
Closed Issues
0
Open Issues
0
Merged PRs
0
Open PRs