Weave Code
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

Alice Bundle Laravel Package

hautelook/alice-bundle

View on GitHub
Deep Wiki
Context7

Faker Providers

As explained in nelmio/alice documentation, you have three ways to declare custom data provider. To use Custom Faker Provider classes you will have to declare them as services:

<?php

namespace AppBundle\DataFixtures\Faker\Provider;

class FooProvider
{
    public static function foo($str)
    {
        return 'foo'.$str;
    }
}

Then declare it as a service with the nelmio_alice.faker.provider tag:

# config/services.yaml

services:
    AppBundle\DataFixtures\Faker\Provider\FooProvider:
        tags: [ { name: nelmio_alice.faker.provider } ]

If autoconfigure is enabled, you can omit the tag as long as your provider extends Faker\Provider\Base:

# config/services.yaml

services:
    AppBundle\DataFixtures\Faker\Provider\FooProvider: ~

That's it! You can now use it in your fixtures:

# fixtures/orm/dummy.yml (Sf4)
# or app/Resources/fixtures/orm/dummy.yml

AppBundle\Entity\Dummy:
    brand{1..10}:
        name: <foo('a string')>

Warning: rely on Custom Faker Providers helpers to generate random data (most of them are static).

Refer to nelmio/alice for a more advanced documentation.

Previous chapter: Advanced usage Next chapter: Custom Alice Processors

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.
daikazu/eloquent-salesforce-objects
unseen-codes/chat
romalytar/yammi-jobs-monitoring-laravel
kisame76/filament-db-table-state
nqxcode/laravel-lucene-search
dpfx/laravel-livewire-wizards
workos/workos-php-laravel
sofa/laravel-global-scope
nawasara/auth-primitives
adhocrat-io/arkhe-main
make-dev/orca-harpoon
itsemon245/lamet
baks-dev/dashboard
amoifr/pickle-panther-bundle
make-dev/orca
dmstr/symfony-system-resources-bundle
dmstr/symfony-job-queue-bundle
dmstr/openapi-json-schema-bundle
dmstr/keycloak-security-bundle
dmstr/doctrine-audit-log-bundle