designbycode/laravel-business-name-generator

Laravel Business Name Generator 是一个 Laravel 包,可以根据形容词和名词的组合生成商业名称。它提供了一种灵活可定制的生成商业名称的方式,可用于各种目的。

v2.1.1 2024-07-20 19:44 UTC

This package is auto-updated.

Last update: 2024-09-20 20:11:04 UTC


README

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

Laravel Business Name Generator 是一个 Laravel 包,可以根据形容词和名词的组合生成商业名称。它提供了一种灵活可定制的生成商业名称的方式,可用于各种目的。

安装

您可以通过 composer 安装此包

composer require designbycode/laravel-business-name-generator

这是发布配置文件的内容

return [
];

用法

基本用法

use Designbycode\LaravelBusinessNameGenerator\Facades\BusinessNameGenerator;
$businessName = BusinessNameGenerator::generate()->first();

自定义形容词和名词

您也可以提供自己的形容词和名词列表

$customAdjectives = ["Cool", "Amazing", "Super"];
$customNouns = ["Shop", "Hub", "Center"];

$generator = BusinessNameGenerator::generate($customAdjectives, $customNouns)->first();
echo $businessName;  // Example output: "Super Shop"

使用特定类别

您可以根据特定类别的形容词和名词生成商业名称

// Generate a business name using playful adjectives and color-related nouns
$businessName = BusinessNameGenerator::generate('playful', 'color')->first();
echo $businessName;  // Example output: "Cheerful Blue"

生成多个名称

// Generate a business name using playful adjectives and color-related nouns
$businessName = BusinessNameGenerator::amount(2)->generate()->get();
echo $businessName;  // Example output: ["Cheerful Blue", "Red Trading]

形容词和名词类别

形容词类别

  • 默认值:标准的商业相关形容词。
  • 幽默:古怪和幽默的形容词。
  • 轻松:轻松愉快的形容词。
  • 颜色:与颜色相关的形容词。
  • 全部:上述所有类别的组合。

名词类别

  • 默认值:标准的商业相关名词。
  • 幽默:古怪和幽默的名词。
  • 轻松:轻松愉快的名词。
  • 颜色:与颜色相关的名词。
  • 全部:上述所有类别的组合。

扩展列表

如果您想扩展形容词或名词列表,您可以创建自己的类来实现 HasGeneratorLists 接口。

namespace YourNamespace;

use Designbycode\BusinessNameGenerator\HasGeneratorLists;

class CustomAdjectives implements HasGeneratorLists
{
    public function default(): array
    {
        return ["Energetic", "Bold", "Brilliant"];
    }

    public function funny(): array
    {
        return ["Zany", "Wacky", "Goofy"];
    }

    public function playful(): array
    {
        return ["Bouncy", "Jovial", "Perky"];
    }

    public function color(): array
    {
        return ["Crimson", "Amber", "Sapphire"];
    }
}

然后使用自定义类与 BusinessNameGenerator 一起使用

use Designbycode\BusinessNameGenerator\BusinessNameGenerator;
use YourNamespace\CustomAdjectives;
use Designbycode\BusinessNameGenerator\Nouns;

$generator = BusinessNameGenerator::generate((new CustomAdjectives())->default(), (new Nouns())->default());

$businessName = BusinessNameGenerator::generate('default', 'default');
echo $businessName;  // Example output: "Energetic Solutions"

测试

composer test

更新日志

请参阅 更新日志 了解最近的变化。

贡献

请参阅 贡献指南 了解详细信息。

安全漏洞

请查看 我们的安全策略 了解如何报告安全漏洞。

致谢

许可

MIT 许可证(MIT)。请参阅 许可文件 了解更多信息。