PHP code example of goldinteractive / craft-publisher
1. Go to this page and download the library: Download goldinteractive/craft-publisher 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/ */
goldinteractive / craft-publisher example snippets
Event::on(
Entries::class,
Entries::EVENT_AFTER_PUBLISH_ENTRY,
function (EntryPublishedEvent $event) {
$entry = $event->entry; // canonical entry that was published
$draft = $event->draft; // draft that was applied, or null for non-draft schedules
$schedule = $event->entryPublish; // the EntryPublish schedule record
// trigger your cache purge here
}
);
shell
* * * * * [PATH_TO_CRAFT]/craft blitz/cache/refresh-expired
* * * * * [PATH_TO_CRAFT]/craft queue/run