-
Notifications
You must be signed in to change notification settings - Fork 48
Phar File Compilation
A default phar file is provided in the releases section of the project on GitHub.
However, it is also possible to compile the phar manually. This allows to:
- Add custom converters
- Add custom templates
- Add Faker locales
To compile the phar:
- Fork the project, then clone it.
- Do whatever you need (add custom converters, custom templates...).
- Run the following command:
make compile
(it might take a few minutes). This will create a file named "gdpr-dump.phar" in the folder "build/dist".
To add converters, there are only two requirements:
- The file must be in the directory "src/Converter" (or a subdirectory).
- The class must implement the interface
ConverterInterface
.
Templates are located in the directory "app/config/templates".
The files must use the .yaml
extension.
By default, the phar file is only bundled with the "en_US" locale (to reduce the phar file size).
The locale used by default is defined by the parameter faker.locale
in app/config/services.yaml.
For example, to change the default locale to "fr_FR":
parameters:
# ...
faker.locale: 'fr_FR'
This locale is automatically added to the phar file during the compilation process.
To add multiple locales to the phar file, you must compile it with the --locale
option.
For example, to compile a phar file that includes "de_DE" and "fr_FR":
make compile c="--locale=fr_FR --locale=de_DE"
The default locale can be omitted, it is automatically added to the phar file.
Available locales can be found in the official faker documentation.