PHP code example of ayacoo / news-tldr

1. Go to this page and download the library: Download ayacoo/news-tldr 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/ */

    

ayacoo / news-tldr example snippets



declare(strict_types=1);

namespace Vendor\Ext\Listener;

use Ayacoo\NewsTldr\Event\ModifyChatGptContentEvent;

class ContentListener
{
    public function setContent(ModifyChatGptContentEvent $event): ModifyChatGptContentEvent
    {
        $row = $event->getRow()
        $text = strip_tags($row['bodytext'] ?? '');

        $content = 'Summarise this text for me in 100 characters: ' . $text;
        $event->setContent($content);

        return $event;
    }
}