Why a new FakerPHP ?
An initial version of FakerPHP was created in 2011 and was very well received by the community. However, the maintainer “sunset” the project in 2020 for various reasons outlined here.
Since then, the project has been forked, but that fork has not been maintained either and is rarely used.
We therefore decided to rebuild the package from scratch to better meet the needs of modern development and to ensure the package’s long-term maintenance.
Why a new FakerPHP?
Key improvements
| Feature | Old Faker | FakerPHP |
|---|---|---|
| Image generation | Broken, online | Working, local, offline |
| Package size | 3.3 MB | 33 KB |
| Modularity | Monolithic | Modular, extensible |
| Extensions | Static | Runtime, can be project-specific |
| Autocompletion | Limited | Dynamic, IDE-friendly |
| Randomizer | Legacy | PHP 8 native |
The problem with the Original Faker
The original Faker library has been a staple for generating fake data in PHP projects for years. However, over time, several pain points became impossible to ignore:
- Broken features: Some functionalities, like image generation, were simply not working. The documentation even admitted it!
- Bloat: The package size ballooned to 3.3 MB, making it heavy for modern projects.
- Lack of modularity: Adding or customizing data generators was cumbersome and not project-friendly.
- Outdated randomizer: It relied on older random generation methods, missing out on the improvements brought by PHP 8.
How this version solves these issues
1. Image generation that actually works
FakerPHP provides fully functional image generation, even offline. Whether you’re on a train, in a plane, or just without internet, you can generate placeholder images locally — no external dependencies, no surprises.
2. Tiny footprint
We’ve reduced the package size from 3.3 MB to just 33 KB. That’s a 99% reduction in size, making FakerPHP lightning-fast to install and ideal for any project, big or small. To do this, we simply included the most essential features in the base package and created extensions for the features that developers use the least, which are often quite specific. Languages are also extensions, so you can download only the ones you need.
3. Modular and extensible
FakerPHP is built with modularity in mind. You can:
- Create extensions on the fly for your project’s specific needs.
- Instantiate extensions at runtime, so your fake data generators are always tailored to your context.
- Auto-discover extensions, so you don’t have to manually register them.
4. Dynamic autocompletion
Say goodbye to guessing method names. FakerPHP offers dynamic autocompletion in your IDE, so you can discover and use available data generators with ease.
5. PHP 8 Randomizer
FakerPHP leverages PHP 8’s new randomizer, bringing you better performance, more reliable randomness, and all the benefits of modern PHP.
Why to choose this FakerPHP?
- Reliability: No more broken features or undocumented limitations.
- Performance: Tiny size, fast installation, and efficient runtime.
- Flexibility: Extend and customize FakerPHP to fit your project’s unique requirements.
- Modern Tooling: Built for PHP 8, with all the latest improvements and up to date with your favorite framework.