1
0
mirror of https://github.com/fzaninotto/Faker.git synced 2025-04-19 23:12:01 +02:00

Merge pull request #1911 from pimjansen/feature/removed-legacy-autoloader

Removed legacy autoloader
This commit is contained in:
Andreas Möller 2020-03-11 13:17:47 +01:00 committed by GitHub
commit d81092c64f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 38 deletions

View File

@ -1,9 +1,14 @@
# CHANGELOG
## TDB, v2.0.0
### Removed
- Removed legacy autoloader [\#1911](https://github.com/fzaninotto/Faker/pull/1911) ([pimjansen](https://github.com/pimjansen))
## 2019-11-10, v1.9.0
This will the last minor release in the `1.x` cycle.
This will the last minor release in the `1.x` cycle.
- Add all Iran's provinces land lines numbers [\#1806](https://github.com/fzaninotto/Faker/pull/1806) ([kingofnull](https://github.com/kingofnull))
- replace latin "B" to cyrillic "B" for uk\_UA locale [\#1800](https://github.com/fzaninotto/Faker/pull/1800) ([FI-LIFE](https://github.com/FI-LIFE))

View File

@ -56,22 +56,14 @@ composer require fzaninotto/faker
### Autoloading
Faker supports both `PSR-0` as `PSR-4` autoloaders.
After installation with `composer`, require `vendor/autoload.php`:
```php
<?php
# When installed via composer
require_once 'vendor/autoload.php';
```
You can also load `Fakers` shipped `PSR-0` autoloader
```php
<?php
# Load Fakers own autoloader
require_once '/path/to/Faker/src/autoload.php';
```
*alternatively, you can use any another PSR-4 compliant autoloader*
### Create fake data
Use `Faker\Factory::create()` to create and initialize a faker generator, which can generate data by accessing properties named after the type of data you want.

View File

@ -1,26 +0,0 @@
<?php
/**
* Simple autoloader that follow the PHP Standards Recommendation #0 (PSR-0)
* @see https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-0.md for more informations.
*
* Code inspired from the SplClassLoader RFC
* @see https://wiki.php.net/rfc/splclassloader#example_implementation
*/
spl_autoload_register(function ($className) {
$className = ltrim($className, '\\');
$fileName = '';
if ($lastNsPos = strripos($className, '\\')) {
$namespace = substr($className, 0, $lastNsPos);
$className = substr($className, $lastNsPos + 1);
$fileName = str_replace('\\', DIRECTORY_SEPARATOR, $namespace) . DIRECTORY_SEPARATOR;
}
$fileName = __DIR__ . DIRECTORY_SEPARATOR . $fileName . $className . '.php';
if (file_exists($fileName)) {
require $fileName;
return true;
}
return false;
});