👀 Get a glimpse of Kirby 5 Learn more
Skip to content

Plugin licenses

Plugin licenses are now shown in the plugins table with an additional column to indicate their status. Licenses can link to their license document, a custom license shop or open a custom dialog to activate the license. #6738

  • New Kirby\Plugin\License class
  • New Kirby\Plugin\LicenseStatus class
  • New k-table-license-cell and k-table-license-status-cell components

Defining a plugin license as simple array

This is great if you want to point to your own license document.

App::plugin(
  name: 'my/plugin',
  extends: [...],
  license: [
    'name'   => 'Custom license',
    'link'   => 'https://mylicenseshop.com',
    'status' => 'active',
  ]
);

Setting a custom status

App::plugin(
  name: 'my/plugin',
  extends: [...],
  license: [
    'name' => 'Custom license',
    'status' => [
      'value' => 'missing',
      'theme' => 'negative',
      'label' => 'Get a license please',
      'icon'  => 'alert'
      'link'  => 'https://mylicenseshop.com',
    ]
  ]
);

A Custom license for your plugin

You can also pass a license object. Extend our Kirby\Plugin\License class to return a custom status, theme, icon and label, depending on the state of your plugin’s license. You can also set a link or your custom dialog's/drawer's endpoint. This is great if you are working with a proprietary license for your plugin, which might still need to purchased/activated by the user.

use Kirby\Plugin\License;
use Kirby\Plugin\LicenseStatus;
use Kirby\Plugin\Plugin;

class MyCustomLicense extends License
{
  public function __construct(
    protected Plugin $plugin
  ){
    $this->name = 'My Custom License';
    $this->link = '<https://mylicenseshop.com>';
    $this->status = LicenseStatus(
      value: 'missing',
      theme: 'negative',
      label: 'Get a license please',
      icon: 'alert',
      dialog: 'my/dialog/endpoint'
    )
  }
}

App::plugin(
  name: 'my/plugin',
  extends: [...],
  license: fn (Plugin $plugin) => new MyCustomLicense($plugin)
);