{"id":13563050,"url":"https://github.com/nelmio/alice","last_synced_at":"2025-05-14T07:07:48.145Z","repository":{"id":5239338,"uuid":"6416536","full_name":"nelmio/alice","owner":"nelmio","description":"Expressive fixtures generator","archived":false,"fork":false,"pushed_at":"2025-04-21T21:20:50.000Z","size":5346,"stargazers_count":2529,"open_issues_count":50,"forks_count":329,"subscribers_count":46,"default_branch":"main","last_synced_at":"2025-05-07T06:38:34.641Z","etag":null,"topics":["alice","expression-language","faker","fixture","fixtures","manage-fixtures","php","symfony","symfony-bundle"],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"coyno/bitcore-electrum","license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nelmio.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":["theofidry"]}},"created_at":"2012-10-27T11:57:40.000Z","updated_at":"2025-05-04T21:59:22.000Z","dependencies_parsed_at":"2023-01-13T13:23:57.345Z","dependency_job_id":"251b910e-a7df-4575-bee1-ec106c2e4161","html_url":"https://github.com/nelmio/alice","commit_stats":{"total_commits":883,"total_committers":148,"mean_commits":5.966216216216216,"dds":0.565118912797282,"last_synced_commit":"5b87f6471351f89e019d24473c19b998cbf4c1f3"},"previous_names":[],"tags_count":81,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nelmio%2Falice","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nelmio%2Falice/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nelmio%2Falice/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nelmio%2Falice/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nelmio","download_url":"https://codeload.github.com/nelmio/alice/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254076850,"owners_count":22010611,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["alice","expression-language","faker","fixture","fixtures","manage-fixtures","php","symfony","symfony-bundle"],"created_at":"2024-08-01T13:01:14.651Z","updated_at":"2025-05-14T07:07:48.118Z","avatar_url":"https://github.com/nelmio.png","language":"PHP","funding_links":["https://github.com/sponsors/theofidry"],"categories":["Table of Contents","PHP","测试","测试 Testing","目录","Testing","测试( Testing )"],"sub_categories":["Testing","测试 Testing","Globalization"],"readme":"\u003cp align=\"center\"\u003e\n    \u003cimg src=\"doc/img/nelmio.png\" width=300 /\u003e\n\u003c/p\u003e\n\n\u003ch1 align=center\u003eAlice - Expressive fixtures generator\u003c/h1\u003e\n\n[![Package version](https://img.shields.io/packagist/v/nelmio/alice.svg?style=flat-square)](https://packagist.org/packages/nelmio/alice)\n[![Build Status](https://github.com/nelmio/alice/workflows/CI/badge.svg?branch=master)](https://github.com/nelmio/alice/actions)\n[![Slack](https://img.shields.io/badge/slack-%23alice--fixtures-red.svg?style=flat-square)](https://symfony.com/slack-invite)\n[![License](https://img.shields.io/badge/license-MIT-red.svg?style=flat-square)](LICENSE)\n\n\nRelying on [FakerPHP/Faker](https://github.com/FakerPHP/Faker), Alice\nallows you to create a ton of fixtures/fake data for use while developing\nor testing your project. It gives you a few essential tools to make it\nvery easy to generate complex data with constraints in a readable and easy\nto edit way, so that everyone on your team can tweak the fixtures if needed.\n\n**Warning: this doc is for alice 3.0. If you want to check the documentation\nfor 2.x, follow [this link](https://github.com/nelmio/alice/tree/2.x)**.\n\n**2.x is in maintenance mode: PRs are accepted, but no active development is done on it by the maintainers any longer.**\n\n\n## Table of Contents\n\n1. [Installation](#installation)\n1. [Example](#example)\n1. [Getting Started](doc/getting-started.md)\n    1. [Basic Usage](doc/getting-started.md#basic-usage)\n    1. [Framework integration](doc/getting-started.md#framework-integration)\n        1. [Symfony](doc/getting-started.md#symfony)\n1. [Complete Reference](doc/complete-reference.md)\n    1. [Creating Fixtures](doc/complete-reference.md#creating-fixtures)\n        1. [YAML](doc/complete-reference.md#yaml)\n        1. [PHP](doc/complete-reference.md#php)\n        1. [JSON](doc/complete-reference.md#json)\n    1. [Fixture Ranges](doc/complete-reference.md#fixture-ranges)\n    1. [Fixture Lists](doc/complete-reference.md#fixture-lists)\n    1. [Fixture Reference](doc/complete-reference.md#fixture-reference)\n    1. [Calling Methods](doc/complete-reference.md#calling-methods)\n        1. [Method arguments with flags](doc/complete-reference.md#method-arguments-with-flags)\n        1. [Method arguments with parameters](doc/complete-reference.md#method-arguments-with-parameters)\n    1. [Specifying Constructor Arguments](doc/complete-reference.md#specifying-constructor-arguments)\n    1. [Using a factory / a named constructor](doc/complete-reference.md#using-a-factory--a-named-constructor)\n    1. [Optional Data](doc/complete-reference.md#optional-data)\n    1. [Handling Unique Constraints](doc/complete-reference.md#handling-unique-constraints)\n1. [Handling Relations](doc/relations-handling.md)\n    1. [References](doc/relations-handling.md#references)\n    1. [Multiple References](doc/relations-handling.md#multiple-references)\n    1. [Self reference](doc/relations-handling.md#self-reference)\n    1. [Passing references to providers](doc/relations-handling.md#passing-references-to-providers)\n1. [Keep Your Fixtures Dry](doc/fixtures-refactoring.md)\n    1. [Fixture Inheritance](doc/fixtures-refactoring.md#fixture-inheritance)\n    1. [Including files](doc/fixtures-refactoring.md#including-files)\n    1. [Variables](doc/fixtures-refactoring.md#variables)\n    1. [Parameters](doc/fixtures-refactoring.md#parameters)\n        1. [Static parameters](doc/fixtures-refactoring.md#static-parameters)\n        1. [Dynamic parameters](doc/fixtures-refactoring.md#dynamic-parameters)\n        1. [Composite parameters](doc/fixtures-refactoring.md#composite-parameters)\n        1. [Usage with functions (constructor included)](doc/fixtures-refactoring.md#usage-with-functions-constructor-included)\n        1. [Inject external parameters](doc/fixtures-refactoring.md#inject-external-parameters)\n1. [Customize Data Generation](doc/customizing-data-generation.md)\n    1. [Faker Data](doc/customizing-data-generation.md#faker-data)\n        1. [Localized Fake Data](doc/customizing-data-generation.md#localized-fake-data)\n        1. [Random data](doc/customizing-data-generation.md#random-data)\n        1. [Default Providers](doc/customizing-data-generation.md#default-providers)\n            1. [Identity](doc/customizing-data-generation.md#identity)\n            1. [Current](doc/customizing-data-generation.md#current)\n            1. [Cast](doc/customizing-data-generation.md#cast)\n    1. [Custom Faker Data Providers](doc/customizing-data-generation.md#custom-faker-data-providers)\n1. [Advanced Guide](doc/advanced-guide.md#advanced-guide)\n    1. [Performance](doc/advanced-guide.md#performance)\n    1. [Expression Language (DSL)](doc/advanced-guide.md#expression-language-dsl)\n        1. [Parameters](doc/advanced-guide.md#parameters)\n        1. [Functions](doc/advanced-guide.md#functions)\n        1. [Identity](doc/advanced-guide.md#identity)\n        1. [Arrays](doc/advanced-guide.md#arrays)\n        1. [Optional](doc/advanced-guide.md#optional)\n        1. [References](doc/advanced-guide.md#references)\n        1. [Property Reference](doc/advanced-guide.md#property-reference)\n    1. [Extending Alice](doc/advanced-guide.md#extending-alice)\n        1. [Custom Flag](doc/advanced-guide.md#custom-flag)\n        1. [Custom Instantiation](doc/advanced-guide.md#custom-instantiator)\n        1. [Custom Accessor](doc/advanced-guide.md#custom-accessor)\n1. [Third-party libraries](#third-party-libraries)\n    1. [Symfony](#symfony)\n    1. [Nette](#nette)\n    1. [Zend Framework 2](#zend-framework-2)\n    1. [Framework Agnostic](#framework-agnostic)\n1. [Contribute](CONTRIBUTING.md#contribute)\n    1. [Differences between 2.x and 3.x](CONTRIBUTING.md#differences-between-2x-and-3x)\n    1. [Architecture](CONTRIBUTING.md#architecture)\n        1. [FixtureBuilder](CONTRIBUTING.md#fixturebuilder)\n        1. [Generator](CONTRIBUTING.md#generator)\n    1. [Expression Language](CONTRIBUTING.md#expression-language)\n    1. [Contributing](CONTRIBUTING.md#contributing)\n        1. [Testing](CONTRIBUTING.md#testing)\n        1. [Profiling](CONTRIBUTING.md#profiling)\n1. [Backward Compatibility Promise (BCP)](#backward-compatibility-promise-bcp)\n1. [Upgrade](#upgrade)\n    1. [Breaking changes between Alice 2.x and 3.0](UPGRADE.md#breaking-changes-between-alice-2x-and-30)\n\n\n## Installation\n\nThis is installable via [Composer](https://getcomposer.org/) as\n[nelmio/alice](https://packagist.org/packages/nelmio/alice):\n\n    composer require --dev nelmio/alice\n\n\n## Example\n\nHere is a complete example of entity declaration:\n\n```yaml\nNelmio\\Entity\\User:\n    user{1..10}:\n        username: '\u003cusername()\u003e'\n        fullname: '\u003cfirstName()\u003e \u003clastName()\u003e'\n        birthDate: '\u003cdate_create()\u003e'\n        email: '\u003cemail()\u003e'\n        favoriteNumber: '50%? \u003cnumberBetween(1, 200)\u003e'\n\nNelmio\\Entity\\Group:\n    group1:\n        name: Admins\n        owner: '@user1'\n        members: '\u003cnumberBetween(1, 10)\u003ex @user*'\n        created: '\u003cdateTimeBetween(\"-200 days\", \"now\")\u003e'\n        updated: '\u003cdateTimeBetween($created, \"now\")\u003e'\n```\n\nYou can then load them easily with:\n\n```php\n$loader = new Nelmio\\Alice\\Loader\\NativeLoader();\n$objectSet = $loader-\u003eloadFile(__DIR__.'/fixtures.yml');\n```\n\nOr load an array right away:\n\n```php\n$loader = new Nelmio\\Alice\\Loader\\NativeLoader();\n$objectSet = $loader-\u003eloadData([\n    \\Nelmio\\Entity\\User::class =\u003e [\n        'user{1..10}' =\u003e [\n            'username' =\u003e '\u003cusername()\u003e',\n            'fullname' =\u003e '\u003cfirstName()\u003e \u003clastName()\u003e',\n            'birthDate' =\u003e '\u003cdate_create()\u003e',\n            'email' =\u003e '\u003cemail()\u003e',\n            'favoriteNumber' =\u003e '50%? \u003cnumberBetween(1, 200)\u003e',\n        ],\n    ],\n    \\Nelmio\\Entity\\Group::class =\u003e [\n        'group1' =\u003e [\n            'name' =\u003e 'Admins',\n            'owner' =\u003e '@user1',\n            'members' =\u003e '\u003cnumberBetween(1, 10)\u003ex @user*',\n            'created' =\u003e '\u003cdateTimeBetween(\"-200 days\", \"now\")\u003e',\n            'updated' =\u003e '\u003cdateTimeBetween($created, \"now\")\u003e',\n        ],\n    ],\n]);\n```\n\nFor more information, refer to [the documentation](#table-of-contents).\n\n\n## Third-party libraries\n\n### Framework Agnostic\n\n- [theofidry/AliceDataFixtures](https://github.com/theofidry/AliceDataFixtures)\n- [trappar/AliceGenerator](https://github.com/trappar/AliceGenerator)\n\n### Symfony\n\n- [hautelook/AliceBundle](https://github.com/theofidry/AliceBundle)\n\n### Nette\n\n-  [Zenify/DoctrineFixtures](https://github.com/Zenify/DoctrineFixtures)\n\n### WordPress\n\n- [rmp-up/wp-fixtures](https://github.com/rmp-up/wp-fixtures)\n\n### Zend Framework 2:\n\n- [ma-si/aist-alice-fixtures](https://github.com/ma-si/aist-alice-fixtures)\n\n\n## Contribute\n\nCheck the [contribution guide](CONTRIBUTING.md).\n\n\n## Backward Compatibility Promise (BCP)\n\nThe policy is for the major part following the same as [Symfony's one][symfony-bc-policy] with a few changes or\nhighlights:\n\n- Code marked with `@private` or `@internal` are excluded from the BCP\n- `Nelmio\\Alice\\Loader\\NativeLoader` is excluded from the BCP: as it is the no DIC solution, registring a new service\n  may require a new method, in which case your code may break if you have already declared that method. To avoid that,\n  please beware of the naming of your methods to avoid any conflicts.\n\n\n## Upgrade\n\nCheck the [upgrade guide](UPGRADE.md).\n\n\n[symfony-bc-policy]: https://symfony.com/doc/current/contributing/code/bc.html\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnelmio%2Falice","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnelmio%2Falice","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnelmio%2Falice/lists"}