Logo Lanfrica

mr-wolf-gb/faker-tunisia

Type de record:

software
Créateur:
mr-
Hôte:
A custom Faker provider for generating Tunisian data for Laravel. # Tunisia Faker Provider (Multi-Locale) A custom Faker provider for generating Tunisian data in multiple locales (fr_TN, en_TN, ar_TN) for Laravel. ## Overview This package provides a custom Faker provider for generating realistic Tunisian data in three locales: - **fr_TN**: French transliteration (Arabic data using the French alphabet) - **en_TN**: English format (Same names as fr_TN but with English address formats) - **ar_TN**: Arabic script (Native Arabic script for all data) The provider includes generators for: - Person names (male and female first names, last names) - Addresses (streets, cities, postal codes, governorates) - Phone numbers (mobile and landline) - Company names and details ## Installation You can install the package via composer: ```bash composer require mr-wolf-gb/faker-tunisia ``` ## Usage ### Basic Usage with Specific Locale ```php // Create a Faker generator with specific locale $faker = \FakerTunisia\TunisiaFakerFactory::create('fr_TN'); // French transliteration // OR $faker = \FakerTunisia\TunisiaFakerFactory::create('en_TN'); // English format // OR $faker = \FakerTunisia\TunisiaFakerFactory::create('ar_TN'); // Arabic script // Generate data in the selected locale $name = $faker->name; $address = $faker->address; $phone = $faker->phoneNumber; $company = $faker->company; ``` ### Mixing Locales One of the key features of this package is the ability to mix locales for different components: ```php // Start with a base locale $faker = \FakerTunisia\TunisiaFakerFactory::create('fr_TN'); // Set specific locales for different components $faker->setLocale('ar_TN', 'names'); // Use Arabic script for names $faker->setLocale('en_TN', 'addresses'); // Use English format for addresses // Generate mixed locale data $name = $faker->name; // Arabic script $address = $faker->address; // English format $phone = $faker->phoneNumber; // French format (default) $company = $faker->company; // French f …