All Projects → nelmio → Alice

nelmio / Alice

Licence: mit
Expressive fixtures generator

Programming Languages

PHP
23972 projects - #3 most used programming language
Makefile
30231 projects

Projects that are alternatives of or similar to Alice

Foundry
A model factory library for creating expressive, auto-completable, on-demand dev/test fixtures with Symfony and Doctrine.
Stars: ✭ 216 (-90.56%)
Mutual labels:  faker, symfony, fixtures
Doctrinefixturesbundle
Symfony integration for the doctrine/data-fixtures library
Stars: ✭ 2,174 (-5.02%)
Mutual labels:  symfony, symfony-bundle, fixtures
mockingbird
🐦 Decorator Powered TypeScript Library for Creating Mocks
Stars: ✭ 70 (-96.94%)
Mutual labels:  fixtures, faker, fixture
Alicedatafixtures
Nelmio Alice extension to persist the loaded fixtures.
Stars: ✭ 228 (-90.04%)
Mutual labels:  symfony, symfony-bundle, fixtures
Alicebundle
A Symfony bundle to manage fixtures with Alice and Faker.
Stars: ✭ 742 (-67.58%)
Mutual labels:  faker, symfony, symfony-bundle
Dunglasangularcsrfbundle
Automatic CSRF protection for JavaScript apps using a Symfony API
Stars: ✭ 152 (-93.36%)
Mutual labels:  symfony, symfony-bundle
Sonatanewsbundle
Symfony SonataNewsBundle
Stars: ✭ 153 (-93.32%)
Mutual labels:  symfony, symfony-bundle
Debug Bundle
The DebugBundle allows greater integration of the VarDumper component in the Symfony full-stack framework.
Stars: ✭ 2,033 (-11.18%)
Mutual labels:  symfony, symfony-bundle
Msgphp
Reusable domain layers. Shipped with industry standard infrastructure.
Stars: ✭ 182 (-92.05%)
Mutual labels:  symfony, symfony-bundle
Symfonyconfigtest
Stars: ✭ 142 (-93.8%)
Mutual labels:  symfony, symfony-bundle
2fa
Two-factor authentication for Symfony applications 🔐 (bunde version ≥ 5)
Stars: ✭ 162 (-92.92%)
Mutual labels:  symfony, symfony-bundle
Sonataadminbundle
The missing Symfony Admin Generator
Stars: ✭ 2,039 (-10.92%)
Mutual labels:  symfony, symfony-bundle
Webauthn Framework
FIDO-U2F / FIDO2 / Webauthn Framework
Stars: ✭ 182 (-92.05%)
Mutual labels:  symfony, symfony-bundle
Core
The server component of API Platform: hypermedia and GraphQL APIs in minutes
Stars: ✭ 2,004 (-12.45%)
Mutual labels:  symfony, symfony-bundle
Craueconfigbundle
Database-stored settings made available via a service for your Symfony project.
Stars: ✭ 154 (-93.27%)
Mutual labels:  symfony, symfony-bundle
Web Profiler Bundle
The WebProfilerBundle provides detailed technical information about each request execution and displays it in both the web debug toolbar and the profiler.
Stars: ✭ 1,905 (-16.78%)
Mutual labels:  symfony, symfony-bundle
Nelmioapidocbundle
Generates documentation for your REST API from annotations
Stars: ✭ 2,009 (-12.23%)
Mutual labels:  symfony, symfony-bundle
Twig Bundle
The Twig Bundle provides configuration for using Twig in your applications.
Stars: ✭ 2,150 (-6.07%)
Mutual labels:  symfony, symfony-bundle
Adminltebundle
AdminLTE bundle for Symfony 4 - an backend/admin theme for easy integration with SF4. Its based on the AdminLTE Template and built with webpack-encore. Supports KNPMenuBundle and FOSUserBundle.
Stars: ✭ 178 (-92.22%)
Mutual labels:  symfony, symfony-bundle
Sonatapagebundle
This bundle provides a Site and Page management through container and block services
Stars: ✭ 181 (-92.09%)
Mutual labels:  symfony, symfony-bundle

Alice - Expressive fixtures generator

Package version Build Status Slack License

Relying on FakerPHP/Faker, Alice allows you to create a ton of fixtures/fake data for use while developing or testing your project. It gives you a few essential tools to make it very easy to generate complex data with constraints in a readable and easy to edit way, so that everyone on your team can tweak the fixtures if needed.

Warning: this doc is for alice 3.0. If you want to check the documentation for 2.x, follow this link.

2.x is in maintenance mode: PRs are accepted, but no active development is done on it by the maintainers any longer.

Table of Contents

  1. Installation
  2. Example
  3. Getting Started
    1. Basic Usage
    2. Framework integration
      1. Symfony
  4. Complete Reference
    1. Creating Fixtures
      1. YAML
      2. PHP
      3. JSON
    2. Fixture Ranges
    3. Fixture Lists
    4. Fixture Reference
    5. Calling Methods
      1. Method arguments with flags
      2. Method arguments with parameters
    6. Specifying Constructor Arguments
    7. Using a factory / a named constructor
    8. Optional Data
    9. Handling Unique Constraints
  5. Handling Relations
    1. References
    2. Multiple References
    3. Self reference
    4. Passing references to providers
  6. Keep Your Fixtures Dry
    1. Fixture Inheritance
    2. Including files
    3. Variables
    4. Parameters
      1. Static parameters
      2. Dynamic parameters
      3. Composite parameters
      4. Usage with functions (constructor included)
      5. Inject external parameters
  7. Customize Data Generation
    1. Faker Data
      1. Localized Fake Data
      2. Random data
      3. Default Providers
        1. Identity
        2. Current
        3. Cast
    2. Custom Faker Data Providers
  8. Advanced Guide
    1. Performance
    2. Expression Language (DSL)
      1. Parameters
      2. Functions
      3. Identity
      4. Arrays
      5. Optional
      6. References
      7. Property Reference
    3. Extending Alice
      1. Custom Flag
      2. Custom Instantiation
      3. Custom Accessor
  9. Third-party libraries
    1. Symfony
    2. Nette
    3. Zend Framework 2
    4. Framework Agnostic
  10. Contribute
    1. Differences between 2.x and 3.x
    2. Architecture
      1. FixtureBuilder
      2. Generator
    3. Expression Language
    4. Contributing
      1. Testing
      2. Profiling
  11. Backward Compatibility Promise (BCP)
  12. Upgrade
    1. Breaking changes between Alice 2.x and 3.0

Installation

This is installable via Composer as nelmio/alice:

composer require --dev nelmio/alice

Example

Here is a complete example of entity declaration:

Nelmio\Entity\User:
    user{1..10}:
        username: '<username()>'
        fullname: '<firstName()> <lastName()>'
        birthDate: '<date_create()>'
        email: '<email()>'
        favoriteNumber: '50%? <numberBetween(1, 200)>'

Nelmio\Entity\Group:
    group1:
        name: Admins
        owner: '@user1'
        members: '<numberBetween(1, 10)>x @user*'
        created: '<dateTimeBetween("-200 days", "now")>'
        updated: '<dateTimeBetween($created, "now")>'

You can then load them easily with:

$loader = new Nelmio\Alice\Loader\NativeLoader();
$objectSet = $loader->loadFile(__DIR__.'/fixtures.yml');

Or load an array right away:

$loader = new Nelmio\Alice\Loader\NativeLoader();
$objectSet = $loader->loadData([
    \Nelmio\Entity\User::class => [
        'user{1..10}' => [
            'username' => '<username()>',
            'fullname' => '<firstName()> <lastName()>',
            'birthDate' => '<date_create()>',
            'email' => '<email()>',
            'favoriteNumber' => '50%? <numberBetween(1, 200)>',
        ],
    ],
    \Nelmio\Entity\Group::class => [
        'group1' => [
            'name' => 'Admins',
            'owner' => '@user1',
            'members' => '<numberBetween(1, 10)>x @user*',
            'created' => '<dateTimeBetween("-200 days", "now")>',
            'updated' => '<dateTimeBetween($created, "now")>',
        ],
    ],
]);

For more information, refer to the documentation.

Third-party libraries

Framework Agnostic

Symfony

Nette

WordPress

Zend Framework 2:

Contribute

Check the contribution guide.

Backward Compatibility Promise (BCP)

The policy is for the major part following the same as Symfony's one with a few changes or highlights:

  • Code marked with @private or @internal are excluded from the BCP
  • Nelmio\Alice\Loader\NativeLoader is excluded from the BCP: as it is the no DIC solution, registring a new service may require a new method, in which case your code may break if you have already declared that method. To avoid that, please beware of the naming of your methods to avoid any conflicts.

Upgrade

Check the upgrade guide.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].