Skip to content

feature: fakerphp/faker integration #198

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 25, 2024
Merged

feature: fakerphp/faker integration #198

merged 2 commits into from
Nov 25, 2024

Conversation

pounard
Copy link
Member

@pounard pounard commented Nov 22, 2024

Two new anonymizers:

  • First one, an address anonymizer, but using faker.
  • Second one, an "any faker method" anonymizer, which awaits a method option, that will then dynamically call this method name on the faker generator for building the sample table.

I also took the liberty of refactoring the sample size handling, in order for pretty much all anonymizers to be able to use it.

The fakerphp/faker dependency is optional, in suggests, in order to make it work gracefully, I added a warning when a dependency is missing in anonymization:list command.

@pounard pounard force-pushed the faker-integration branch 3 times, most recently from 0a5d7c6 to 0438044 Compare November 22, 2024 14:24
Copy link
Member

@SimonMellerin SimonMellerin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a super good feature!

But not sure I want to see Faker arrives in core.

At the beginning, I wanted the DbToolsBundle to be modular precisely to avoid having a big lib as Faker.

It's something that Faker's creator himself regretted : it's something that Faker's creator himself regretted

So to keeping this original goal in mind, I'd prefer to have a FakerPack instead.

@pounard
Copy link
Member Author

pounard commented Nov 22, 2024

At the beginning, I wanted the DbToolsBundle to be modular precisely to avoid having a big lib as Faker.

It's something that Faker's creator himself regretted : it's something that Faker's creator himself regretted

So to keeping this original goal in mind, I'd prefer to have a FakerPack instead.

I thought as well at the beginning, but the fact that having addresses in as much languages as Faker supports is really nice to have.

Further, if later we package a docker image or a phar archive, it would probably be completely useless without many anonymizers included!

The more I think of it, the more I think we will never manage supporting as many languages as Faker, and even more, I'd say that we don't even speak more than 3 languages ourselves.

@pounard
Copy link
Member Author

pounard commented Nov 25, 2024

OK, following the discussion, I created https://github.com/DbToolsBundle/pack-faker which is not released yet, nor propagated on packagist.

It's awaiting review as well.

It nevertheless uses some internal changes I introduced in this very specific PR, so I'll need a review for it.

@pounard pounard merged commit 7de47e1 into main Nov 25, 2024
28 checks passed
@pounard pounard deleted the faker-integration branch November 25, 2024 12:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants