PHP code example of twin-elements / post-bundle

1. Go to this page and download the library: Download twin-elements/post-bundle 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/ */

    

twin-elements / post-bundle example snippets


class PostPreviewGenerator implements PostPreviewGeneratorInterface
{
    private RouterInterface $router;

    public function __construct(RouterInterface $router)
    {
        $this->router = $router;
    }

    public function generatePreviewUrl(Post $post): string
    {
        return $this->router->generate('post', [
            'id' => $post->getId(),
            'slug' => $post->getSlug()
        ]);
    }
}