Statie uses common EventDispatcher that allows you to get into application cycle in few spots.

Available Events

You can find all events as standalone classes in /src/Event directory:

  • BeforeRenderEvent - is called after all GeneratorElement and Files and before they will be saved to file system

How to Hook In?

Just create your subscriber


namespace App\Statie\Twitter;

use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symplify\Statie\Event\BeforeRenderEvent;

final class TweetNewPostsSubscriber implements EventSubscriberInterface
     * @return string[] 
    public static function getSubscribedEvents(): array
        return [BeforeRenderEvent::class => 'tweetNewPosts'];

    public function tweetNewPosts(BeforeRenderEvent $beforeRenderEvent): void
        // ...

And register as service in statie.yml

# statie.yml
   App\Statie\Twitter\TweetNewPostsSubscriber: ~

Your subscriber will be called right when BeforeRenderEvent occurs!