Skip to content

cspivack/faker-baseball

Repository files navigation

Faker Baseball

Software License Build Status StyleCI Quality Score Code Coverage

A Faker provider that uses the Fighting Baseball roster to generate names, teams, and positions.

Installation

Add the Faker Baseball library to your composer.json file:

composer require cspivack/faker-baseball

Usage

To use this provider with Faker, you must add the provider class to the Faker generator:

<?php

$faker = \Faker\Factory::create();
$faker->addProvider(new \Cspivack\Faker\FightingBaseballProvider($faker));

/* General data */
$faker->playerName();          // A name using random first and last names
$faker->playerPosition();      // One of the positions in the game
$faker->playerTeam();          // One of the teams in the game

/* Data for a specific player */
$faker->player()->name();      // A player's full name
$faker->player()->firstName(); // A player's first name
$faker->player()->lastName();  // A player's first name
$faker->player()->team();      // A player's team
$faker->player()->position();  // A player's position
$faker->player()->benched();   // Whether the player is coming off the bench or not (boolean)

Tests

Run tests with composer test

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages