承接 bishwajitcadhikary/laravel-faker-extended 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

bishwajitcadhikary/laravel-faker-extended

Composer 安装命令:

composer require bishwajitcadhikary/laravel-faker-extended

包简介

Extend Laravel's default Faker with additional data providers

README 文档

README

Extend Laravel's default Faker with additional data providers for more realistic test data generation.

Installation

You can install the package via composer:

composer require bishwajitcadhikary/laravel-faker-extended

The package will automatically register its service provider.

Usage

Once installed, the extended Faker providers will be automatically available in your Laravel application. You can use them in your database seeders, factories, or any other place where you use Faker.

Available Data Providers

Person Provider

// Use in a factory or seeder
$faker = app(\Faker\Generator::class);

// Get a job title
$jobTitle = $faker->jobTitle(); // 'Senior Software Engineer'

// Get personality traits
$trait = $faker->personalityTraits(); // 'Analytical'
$traits = $faker->personalityTraits(3); // ['Creative', 'Detail-oriented', 'Innovative']

// Get a personality profile
$profile = $faker->personalityProfile();
// [
//     'strengths' => ['Analytical', 'Creative'],
//     'weaknesses' => ['Perfectionist'],
//     'mbti' => 'INTJ'
// ]

// Get an age
$age = $faker->age(25, 45); // 32

Company Provider

// Get a company type
$companyType = $faker->companyType(); // 'LLC'

// Get a business sector
$sector = $faker->sector(); // 'Technology'

// Get a mission statement
$mission = $faker->missionStatement(15); // 'Our mission is to...'

// Get company values
$value = $faker->companyValues(1); // 'Innovation'
$values = $faker->companyValues(3); // ['Integrity', 'Teamwork', 'Excellence']

// Get funding information
$fundingRound = $faker->fundingRound(); // 'Series A'
$fundingAmount = $faker->fundingAmount(5, 20); // '$12.5M'
$fundingInfo = $faker->fundingInfo();
// [
//     'round' => 'Series A',
//     'amount' => '$12.5M',
//     'investors' => 3,
//     'valuation' => '$75M',
//     'date' => '2023-05-15'
// ]

Internet Provider

// Get a social media handle
$handle = $faker->socialMediaHandle(); // '@johndoe'

// Get a social media platform
$platform = $faker->socialPlatform(); // 'Twitter'

// Get social profiles
$profiles = $faker->socialProfiles(2);
// [
//     'Twitter' => '@johndoe',
//     'LinkedIn' => '@johndoe'
// ]

// Get programming languages
$language = $faker->programmingLanguage(); // 'Python'
$languages = $faker->programmingLanguages(3); // ['JavaScript', 'Python', 'PHP']

// Get tech stack
$techStack = $faker->techStack();
// [
//     'frontend' => 'React',
//     'backend' => 'Laravel',
//     'database' => 'PostgreSQL',
//     'languages' => ['JavaScript', 'PHP', 'Python']
// ]

Location Provider

// Get a startup hub
$hub = $faker->startupHub(); // 'San Francisco'

// Get a neighborhood
$neighborhood = $faker->neighborhood(); // 'Financial District'

// Get a complete office location
$officeLocation = $faker->officeLocation();
// [
//     'type' => 'Headquarters',
//     'building' => '123',
//     'street' => 'Main St',
//     'neighborhood' => 'Financial District',
//     'city' => 'San Francisco',
//     'zipcode' => '94105',
//     'country' => 'United States',
//     'coordinates' => [
//         'latitude' => 37.7749,
//         'longitude' => -122.4194
//     ]
// ]

// Get company locations
$locations = $faker->companyLocations(2);
// [
//     [
//         'city' => 'San Francisco',
//         'type' => 'Headquarters',
//         'employees' => 250
//     ],
//     [
//         'city' => 'New York',
//         'type' => 'Sales Office',
//         'employees' => 30
//     ]
// ]

Education Provider

// Get a degree
$degree = $faker->degree(); // 'Bachelor of Science'

// Get a field of study
$field = $faker->fieldOfStudy(); // 'Computer Science'

// Get a university
$university = $faker->university(); // 'Harvard University'

// Get an education history
$education = $faker->educationHistory(2);
// [
//     [
//         'degree' => 'Bachelor of Science',
//         'field' => 'Computer Science',
//         'university' => 'Stanford University',
//         'startYear' => 2014,
//         'endYear' => 2018,
//         'gpa' => '3.8/4.0'
//     ],
//     [
//         'degree' => 'Master of Business Administration',
//         'field' => 'Finance',
//         'university' => 'Harvard University',
//         'startYear' => 2018,
//         'endYear' => 2020,
//         'gpa' => '3.9/4.0'
//     ]
// ]

// Get skills
$skill = $faker->skill('Technical'); // 'Programming'
$skillSet = $faker->skillSet(3);
// [
//     ['name' => 'Programming', 'category' => 'Technical'],
//     ['name' => 'Communication', 'category' => 'Soft Skills'],
//     ['name' => 'Project Management', 'category' => 'Business']
// ]

Quotes Provider

// Get an inspirational quote
$quote = $faker->inspirationalQuote();
// ['quote' => 'The only way to do great work is to love what you do.', 'author' => 'Steve Jobs']

// Get just the quote text without author
$quoteText = $faker->inspirationalQuote(false);
// 'The only way to do great work is to love what you do.'

// Get specific quote types
$businessQuote = $faker->businessQuote();
$technologyQuote = $faker->technologyQuote();
$leadershipQuote = $faker->leadershipQuote();
$movieQuote = $faker->movieQuote();
$programmingQuote = $faker->programmingQuote();

// Get a random quote of any type
$randomQuote = $faker->randomQuote();
// [
//     'quote' => 'First, solve the problem. Then, write the code.',
//     'author' => 'John Johnson',
//     'type' => 'programming'
// ]

// Get multiple quotes
$quotes = $faker->quotes(3, 'business', true);
// Array of 3 business quotes with authors

// Get multiple quotes of random types
$randomQuotes = $faker->quotes(5);
// Array of 5 random quotes of different types

Creating a Factory Using Extended Providers

namespace Database\Factories;

use App\Models\User;
use Illuminate\Database\Eloquent\Factories\Factory;

class UserFactory extends Factory
{
    protected $model = User::class;

    public function definition()
    {
        return [
            'name' => $this->faker->name(),
            'email' => $this->faker->unique()->safeEmail(),
            'job_title' => $this->faker->jobTitle(),
            'personality' => $this->faker->personalityTraits(3),
            'favorite_quote' => $this->faker->inspirationalQuote(),
            'skills' => $this->faker->skillSet(5),
            'education' => $this->faker->educationHistory(2),
        ];
    }
}

License

The MIT License (MIT). Please see License File for more information.

bishwajitcadhikary/laravel-faker-extended 适用场景与选型建议

bishwajitcadhikary/laravel-faker-extended 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 38 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 03 月 24 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 bishwajitcadhikary/laravel-faker-extended 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 bishwajitcadhikary/laravel-faker-extended 我们能提供哪些服务?
定制开发 / 二次开发

基于 bishwajitcadhikary/laravel-faker-extended 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 38
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 13
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-03-24