soul-was-here / faker-planet
Faker provider for generating fake Planets
1.0.0
2023-08-19 10:41 UTC
Requires
- php: ^8.1
- fakerphp/faker: ^1.23
Requires (Dev)
- phpunit/phpunit: ^10.0
README
This package will allow Faker to generate planet description including name, type, size, radius, gravity, temperature and water prevalence. There are also several planet templates. See the Usage section for examples.
This package ignores some realistic scientific details (such as scientific planet names) and used to create an interesting background for your story or game etc.
Install
To install, use composer:
composer require soul-was-here/faker-planet
Usage
$faker = \Faker\Factory::create(); $faker->addProvider(new \Faker\Provider\Planet($faker)); /* * Generate planet name. */ echo $faker->planetName(); //Clenai /* * Generate planet type. */ echo $faker->planetType(); //Gas Giant /* * Generate planet size based on Earth's radius (R / R Earth). * Between 0.4x Earth radius and 15x Earth radius. */ echo $faker->planetSize(); //1.5 /* * Generate planet radius. * Between 0.4x Earth radius (2548 km) and 15x Earth radius (95565 km). */ echo $faker->planetRadius(); // 5885 /* * Generate planet gravity based on Earth's gravity (G / G Earth). * Between 0.5x Earth gravity and 400x Earth gravity. */ echo $faker->planetGravity(); // 1.8 /* * Generate planet average temperature. * Between -250°C and 1100°C */ echo $faker->planetTemperature(); // 230 /* * Generate prevalence of water in percent. * Between 0% and 100% */ echo $faker->planetWaterPrevalence(); // 25 /* * Generate an array representation of an Ice Giant planet. */ echo $faker->planetIceGiant(); //[ // 'planetType' => 'Ice Giant', // 'planetSize' => 3.59, // 'planetRadius' => 22871, // 'planetGravity' => 201.04, // 'planetTemperature' => 340, // 'planetWaterPrevalence' => 9 //] // You can choose any of these predefined planet types: $faker->planetIceGiant(); $faker->planetDesert(); $faker->planetEarthLike(); $faker->planetGasGiant(); $faker->planetHumid(); $faker->planetIceGiant(); $faker->planetIce(); $faker->planetRockyExtremeTemperatures(); $faker->planetRockyNoAtmosphere(); $faker->planetRockyFurnace(); $faker->planetRocky(); $faker->planetToxic(); $faker->planetWaterWorld();