PHP code example of fabricio872 / random-message-bundle

1. Go to this page and download the library: Download fabricio872/random-message-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/ */

    

fabricio872 / random-message-bundle example snippets


// config/bundles.php
return [
    // ...
    Fabricio872\RandomMessageBundle\RandomMessageBundle::class => ['all' => true],
];

// src/Controller/SomeController.php

    // ...

    #[Route('/some_path', 'some_name')]
    public function some_name(RandomMessage $randomMessage)
    {
        $message = $randomMessage->getMessage();
        
        return $this->render('some-view.html.twig', [
            'randomMessage'=> $message
        ]);
    }
    
    // ...
en