In my Craft 2 plugin my initial init function looked like:

public function init()

    if(!extension_loaded('imagick')) {
        PdfThumbnailerPlugin::log("imagick library not found - cannot make pdf thumbnails" , LogLevel::Warning);

    craft()->on('entries.saveEntry', function(Event $event) {

    craft()->on('assets.saveAsset', function(Event $event) {
        PdfThumbnailerPlugin::log("on save asset");


I cannot understand (due to lack of devchops) or find an example of how to call my functions (which were in service files) in Craft3.

I can see the constants used in the new style 'listener' but have no idea what or where these are referenced in the v3 docs.

    // Register our site routes
        function (RegisterUrlRulesEvent $event) {
            $event->rules['siteActionTrigger1'] = 'pdfthumbnailer/save-entry';
            $event->rules['siteActionTrigger2'] = 'pdfthumbnailer/save-asset';

My plugin in craft 2 would create a thumbnail from the first page of a PDF asset.

UPDATE: SO i eventually made some progress with :


Except this kept saying it could not find service method:

Getting unknown property: joomkit\pdfthumbnailer\Pdfthumbnailer::SaveEntry 

It turns out that the method 'SaveEntry' only was found when named 'saveEntry'. Why would this be the case? (excuse pun)

  • SaveEntry in your case is the name of a component. There is a function registerComponents you should check what parameters you pass to this function Commented Jul 2, 2018 at 11:39
  • Brilliant Robin. Its defined in composer extra ->components->saveEntry Is this the norm for service declaration now?
    – joomkit
    Commented Jul 2, 2018 at 11:53
  • I suggest you to remove that part during development Commented Jul 2, 2018 at 11:54

1 Answer 1


I can't answer the question fully without seeing your plugin code, but I'd suggest you generate your plugin scaffolding with pluginfactory.io to see how it all fits together.

It's also helpful to look at a existing plugin that works; here's one I wrote that's pretty simple, and should be easy to follow: FastCGI Cache Bust

Roughly, you'd do something like:


Or if you do it the pluginfactory.io way:

  • Thanks andrew. Ironically I did use pluginfactory but was wondering what the on entry save event looks like in craft3. will dig in
    – joomkit
    Commented Jul 2, 2018 at 8:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.