0

I keep getting this error when I am trying to test Faker PHP from github on my server:

Fatal error: Class 'Faker\Provider\en_US\Address' not found in /home/andrew/public_html/JeffWork/src/Faker/Provider/en_US/Address.php on line 6

Link: http://aswanson.net/JeffWork/test/test.php

All of the package files have been installed and uploaded properly, and the code on line 5 & 6 looks like:

class Address extends \Faker\Provider\en_US\Address
{
Jay Blanchard
  • 34,243
  • 16
  • 77
  • 119

1 Answers1

1

Please make sure whether the file exists in the folder where your referring for "/home/andrew/public_html/JeffWork/src/Faker/Provider/en_US/Address.php".

Please take a new update with composer with the following

composer require fzaninotto/faker

Now with the updated version 1.6, you will be able to solve this kind of issue make sure to use autoload.php in file where your using.

The following shows the snippet of usage

    <?php

    require_once 'vendor/autoload.php';

    $faker = Faker\Factory::create();
    $person = new Faker\Provider\en_US\Person($faker);
    $address = new Faker\Provider\en_US\Address($faker);

    foreach(range(1,10) as $i){
        echo $address->address(),'<br/>';
    } 

Cheers!

Channaveer Hakari
  • 2,769
  • 3
  • 34
  • 45