Skip to content
On this page
developed by

Pack FR_Fr

This page list Anonymizers provided by the pack FR_Fr.

LastnameAnonymizer

Same as LastnameAnonymizer from core, but with a provided sample of 500 french lastnames.

php
namespace App\Entity;

use Doctrine\ORM\Mapping as ORM;
use MakinaCorpus\DbToolsBundle\Attribute\Anonymize;

#[ORM\Entity()]
#[ORM\Table(name: '`user`')]
class User
{
    // ...

    #[ORM\Column(length: 255)]
    #[Anonymize('fr_fr.lastname')] 
    private ?string $lastname = null;

    // ...
}
yaml
# config/anonymization.yaml

user:
    lastname: fr_fr.lastname
#...

FirstnameAnonymizer

Same as FirstnameAnonymizer from core, but with a provided sample of 500 french firstnames.

php
namespace App\Entity;

use Doctrine\ORM\Mapping as ORM;
use MakinaCorpus\DbToolsBundle\Attribute\Anonymize;

#[ORM\Entity()]
#[ORM\Table(name: '`user`')]
class User
{
    // ...

    #[ORM\Column(length: 255)]
    #[Anonymize('fr_fr.firstname')] 
    private ?string $firstname = null;

    // ...
}
yaml
# config/anonymization.yaml

user:
    firstname: fr_fr.firstname
#...

PhoneAnonymizer

Generates random french phone numbers, using reserved prefixes dedicated to fictional usage (those phone numbers will never exist).

Available option is mode which can either be mobile or landline. Default value is mobile.

php
namespace App\Entity;

use Doctrine\ORM\Mapping as ORM;
use MakinaCorpus\DbToolsBundle\Attribute\Anonymize;

#[ORM\Entity()]
#[ORM\Table(name: '`user`')]
class User
{
    // ...

    #[ORM\Column(length: 255)]
    #[Anonymize('fr_fr.phone', ['mode' => 'landline'])] 
    private ?string $telephoneFixe = null;

    #[ORM\Column(length: 255)]
    #[Anonymize('fr_fr.phone')] 
    private ?string $telephoneMobile = null;

    // ...
}
yaml
# config/anonymization.yaml

user:
    telephone_fixe:
        anonymizer: fr_fr.phone
        options:
            # either 'landline' or 'mobile' (default is 'mobile')
            mode: landline
    telephone_mobile: phone
#...

AddressAnonymizer

Same as AddressAnonymizer from core but with a provided sample of 500 french dumb adresses.

php
namespace App\Entity;

use Doctrine\ORM\Mapping as ORM;
use MakinaCorpus\DbToolsBundle\Attribute\Anonymize;

#[ORM\Entity()]
#[ORM\Table(name: '`user`')]
#[Anonymize(type: 'fr_fr.address', options: [ 
    'street_address' => 'street', 
    'secondary_address': 'street_second_line' 
    'postal_code' => 'zip_code', 
    'locality' => 'city', 
    'region' => 'region' 
    'country' => 'country', 
])] 
class User
{
    // ...

    #[ORM\Column(length: 255)]
    private ?string $street = null;

    #[ORM\Column(length: 255)]
    private ?string $streetSecondLine = null;

    #[ORM\Column(length: 255)]
    private ?string $zipCode = null;

    #[ORM\Column(length: 255)]
    private ?string $city = null;

    #[ORM\Column(length: 255)]
    private ?string $region = null;

    #[ORM\Column(length: 255)]
    private ?string $country = null;

    // ...
}
yaml
# config/anonymization.yaml
user:
    address:
        target: table
        anonymizer: fr_fr.address
        options:
            street_address: 'street'
            secondary_address: 'street_address_2'
            postal_code: 'zip_code'
            locality: 'city'
            region: 'region'
            country: 'country'
  #...

Released under the MIT License.