test.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. require __DIR__ .'/../vendor/autoload.php';
  3. $faker = Faker\Factory::create();
  4. $faker->seed(5);
  5. echo '<?xml version="1.0" encoding="UTF-8"?>';
  6. ?>
  7. <contacts>
  8. <?php for ($i=0; $i < 10; $i++): ?>
  9. <contact firstName="<?php echo $faker->firstName ?>" lastName="<?php echo $faker->lastName ?>" email="<?php echo $faker->email ?>" >
  10. <phone number="<?php echo $faker->phoneNumber ?>"/>
  11. <?php if ($faker->boolean(25)): ?>
  12. <birth date="<?php echo $faker->dateTimeThisCentury->format('Y-m-d') ?>" place="<?php echo $faker->city ?>"/>
  13. <?php endif; ?>
  14. <address>
  15. <street><?php echo $faker->streetAddress ?></street>
  16. <city><?php echo $faker->city ?></city>
  17. <postcode><?php echo $faker->postcode ?></postcode>
  18. <state><?php echo $faker->state ?></state>
  19. </address>
  20. <company name="<?php echo $faker->company ?>" catchPhrase="<?php echo $faker->catchPhrase ?>">
  21. <?php if ($faker->boolean(33)): ?>
  22. <offer><?php echo $faker->bs ?></offer>
  23. <?php endif; ?>
  24. <?php if ($faker->boolean(33)): ?>
  25. <director name="<?php echo $faker->name ?>" />
  26. <?php endif; ?>
  27. </company>
  28. <?php if ($faker->boolean(15)): ?>
  29. <details>
  30. <![CDATA[
  31. <?php echo $faker->text(400) ?>
  32. ]]>
  33. </details>
  34. <?php endif; ?>
  35. </contact>
  36. <?php endfor; ?>
  37. </contacts>