PHP code example of designbycode / business-name-generator

1. Go to this page and download the library: Download designbycode/business-name-generator library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

designbycode / business-name-generator example snippets




use Designbycode\BusinessNameGenerator\BusinessNameGenerator;
use Designbycode\BusinessNameGenerator\Nouns;
use Designbycode\BusinessNameGenerator\Adjectives;

// Create a new BusinessNameGenerator instance
$generator = new BusinessNameGenerator();

// Generate a business name using default adjectives and funny nouns
$businessName = $generator->generate('default', 'funny');
echo $businessName;  // Example output: "Innovative Banana"
 
$customAdjectives = ["Cool", "Amazing", "Super"];
$customNouns = ["Shop", "Hub", "Center"];

$generator = new BusinessNameGenerator($customAdjectives, $customNouns);

$businessName = $generator->generate();
echo $businessName;  // Example output: "Super Shop"

 
$generator = new BusinessNameGenerator();

// Generate a business name using playful adjectives and color-related nouns
$businessName = $generator->generate('playful', 'color');
echo $businessName;  // Example output: "Cheerful Blue"
 
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"];
    }
}



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

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

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