Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Company Name Generator Laravel Package

fzaninotto/company-name-generator

Generate random, believable company names in PHP with fzaninotto/company-name-generator. Ideal for database seeders, test fixtures, and demo apps, it offers a simple API and Composer installation with no heavy dependencies.

View on GitHub
Deep Wiki
Context7

Getting Started

This is a single-class, dependency-free library — not a Laravel package. There is no service provider, no facade, no config, and no auto-discovery. Installation is a one-liner:

composer require fzaninotto/company-name-generator

Because it is archived and has zero dependents, treat it as "vendored convenience code" rather than infrastructure — pin it in composer.json and don't expect fixes.

The first thing to do is open vendor/fzaninotto/company-name-generator/src/Generator.php. The entire library is one short class containing two word lists (prefixes and suffixes) and one method that picks a random pair. Confirm the exact namespace and method name there before writing anything else — this is a 2016-era package and the public surface is one call:

use Fzaninotto\CompanyNameGenerator\Generator;

$generator = new Generator();
echo $generator->generateName(); // e.g. "Blue Labs", "Big Soft"

The natural first use case in Laravel is demo and test data: naming fake tenants, organisations, or accounts in seeders and factories where "Acme Corp" repeated 200 times makes the UI untestable. Reach for it in a seeder before you reach for anything else.

Implementation Patterns

Wrap it, don't scatter it. Bind a tiny interface in a service provider so tests and future replacements don't depend on the concrete class:

// app/Support/CompanyNamer.php
interface CompanyNamer { public function next(): string; }

// app/Support/GeneratedCompanyNamer.php
final class GeneratedCompanyNamer implements CompanyNamer
{
    public function next(): string
    {
        return (new \Fzaninotto\CompanyNameGenerator\Generator())->generateName();
    }
}
// app/Providers/AppServiceProvider.php
$this->app->singleton(CompanyNamer::class, GeneratedCompanyNamer::class);

Factory states. The most common day-to-day pattern:

// database/factories/CompanyFactory.php
public function definition(): array
{
    $name = app(CompanyNamer::class)->next();

    return [
        'name' => $name,
        'slug' => Str::slug($name),
        'email' => 'hello@'.Str::slug($name).'.test',
    ];
}

Seeders need uniqueness. The word lists are small, so collisions are frequent. Wrap in a retry or collect into a set:

$seen = [];
while (count($seen) < 50) {
    $seen[app(CompanyNamer::class)->next()] = true;
}

Testing. Because it's random, inject a deterministic fake in tests:

$this->app->instance(CompanyNamer::class, new class implements CompanyNamer {
    public function next(): string { return 'Fixed Company'; }
});

If you want reproducible output without a fake, seed the RNG (mt_srand(42)) in setUp() — verify in the source whether it uses mt_rand/array_rand so your seed actually takes effect.

Preview command. A small artisan command that prints 20 names is the fastest way to evaluate whether the vocabulary suits your domain and to sanity-check dedupe rates:

public function handle(CompanyNamer $namer): void
{
    for ($i = 0; $i < 20; $i++) {
        $this->line($namer->next());
    }
}

Composition with Faker. For richer fixtures, use this for the display name and Faker for domain, address, and phone so you don't get Blue Labs at company1.test:

'domain' => Str::slug($name).'.'.fake()->tld(),

Gotchas and Tips

  • Archived status. Composer may report the package as abandoned. That's harmless for require-dev-style use, but do not put it on a real customer-facing code path. If it bothers you, "replace" it or fork the ~50 lines into app/Support.
  • No Laravel integration. No facade, config, or publishable assets. Anything you want configurable — custom prefixes, suffixes, locale flavor — you must build by subclassing and overriding the protected arrays, or by copying the word lists into your own config. Read the class first; the arrays are the extension point.
  • Vocabulary is opinionated. Output is Anglo tech-startup flavored ("Big Soft", "Code Tower"). It reads fine in a dashboard mock and badly in anything user-visible to real clients.
  • Collisions are the main operational risk. With small lists the name space is in the low thousands; any unique index on companies.name will throw. Handle with a retry loop or dedupe before insert rather than catching QueryException.
  • Randomness source. If you're asserting on output in a test, seeding is fragile across PHP versions if the implementation uses rand() vs mt_rand(). Prefer the injected-fake pattern above for anything you actually assert on.
  • PSR-4/autoload caveat. If you see Class not found after install, check composer dump-autoload -o and confirm the namespace in the file header — the namespace in the source doesn't always match what the package name implies.
  • Upgrade path is a copy-paste. Since the package is archived and trivial, the correct long-term move is to inline the two word arrays into a config file and write ten lines of Arr::random() yourself. That removes the dependency, gives you control over the vocabulary, and eliminates the abandoned-package warning entirely.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
diephp/sequences
users-au/socialite-provider
twidpay/twid-logger
mrnewport/laravel-plaid
mrnewport/laravel-repo
mrnewport/laravel-docsign
mrnewport/laravel-stow
mrnewport/laravel-flow
mrnewport/laravel-priceable
mrnewport/laravel-nestedterms
fredmeng/laravel-apidoc-generator
itstructure/laravel-multilingual-tools
pdustdar/elasticsearch
markupai/php-sdk
rlacerda83/lumem-microservice-shipment
uni-method/symfony-lib
tacticmedia/scim-server-bundle
neika-ai/symfony-bundle
mattleads/agent-publishing-bundle
glavweb/framework-bundle