PHP code example of fakerino / symfony-fakerino

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

    

fakerino / symfony-fakerino example snippets


public function registerBundles()
{
    // ...
  $bundles = array(
           new Fakerino\Bundle\FakerinoBundle\FakerinoBundle(),
    // ...
}


namespace Acme\DemoBundle\Controller;

use Fakerino\Core\FakeDataFactory;
use Symfony\Component\HttpFoundation\Response;
use Twig_Environment;

class HelloController
{
    public function __construct(FakeDataFactory $fakerino, Twig_Environment $twig)
    {
        $this->fakerino = $fakerino;
        $this->twig = $twig;
    }

    public function helloAction()
    {
        $person = $this->fakerino->fake('fakeFemale');
        $duty = $this->fakerino->fakeTemplate('<p>Remeber the appointment with {{ surname }} in {{ country }}</p>');

        return new Response('<html><body> Hello '.$person.'!'.$duty.'</body></html>');
    }

    public function twigAction()
    {
        return new Response(
            $this->twig->render('AcmeDemoBundle:Demo:my_fakerino_demo.html.twig')
        );
    }
}