PHP code example of r1pp3rj4ck / lipsum-bundle

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

    

r1pp3rj4ck / lipsum-bundle example snippets



// app/AppKernel.php

if (in_array($this->getEnvironment(), array('dev', 'test'))) {
    // ...
    $bundles[] = new r1pp3rj4ck\LipsumBundle\r1pp3rj4ckLipsumBundle();
    // ...
}



$profileGenerator = $this->container->get('r1pp3rj4ck.lipsum.generator.profile');

$userData    = $profileGenerator->getUserData(ProfileGenerator::SEX_RANDOM);
$refUserData = array(
  'fullName'   => 'John Doe',
  'firstName'  => 'John',
  'middleName' => '',
  'lastName'   => 'Doe',
  'userName'   => 'john.doe314',
  'email'      => '[email protected]',
);
// $userData and $refUserData will look like the same but with another data
// ProfileGenerator::getUserData($sex = ProfileGenerator::SEX_RANDOM);
// possible $sex values: SEX_RANDOM, SEX_MALE, SEX_FEMALE

$name    = $profileGenerator->getName(ProfileGenerator::SEX_FEMALE, false)
$refName = array(
  'fullName'   => 'Jane Doe',
  'firstName'  => 'Jane',
  'middleName' => '',
  'lastName'   => 'Doe',
);
// $name and $refName will look like the same but with another data
// ProfileGenerator::getName($sex = ProfileGenerator::SEX_RANDOM, $middleName = false)

$firstName = $profileGenerator->getFirstName(ProfileGenerator::SEX_MALE);
$refFirstName = 'John';

$name        = 'Jane Mary Doe';
$userName    = $profileGenerator->getUserName($name);
$refUserName = 'jane.mary.doe813';
$email       = $profileGenerator->getEmail($userName);
$refEmail    = '[email protected]';



$randomGenerator = $this->container->get('r1pp3rj4ck.lipsum.generator.random');

$lipsum = $randomGenerator->getRandom(42, RandomGenerator::PUNCTUATION_ON);
// $lipsum will be a 42 words long string, containing punctuation randomly,
// always with a dot on the end.
// possible punctuation values:
// PUNCTUATION_NONE   - no punctuation at all
// PUNCTUATION_AT_END - a dot at the end of string, nowhere else
// PUNCTUATION_ON     - (default) contains punctuation randomly + a dot at the end




$addressGenerator = $this->container->get('r1pp3rj4ck.lipsum.generator.address');

$address = $addressGenerator->getStreetName();
// $address == 'Holly Drive'

$address = $addressGenerator->getAddress();
// $address == array(
//   'streetName'   => 'Holly Drive',
//   'streetNumber' => 242,
//   'fullAddress'  => 'Holly Drive 242',
// );
bash
$ php composer.phar update
bash
$ php composer.phar update r1pp3rj4ck/lipsum-bundle