{"id":16541377,"url":"https://github.com/aerni/statamic-factory","last_synced_at":"2025-03-15T11:33:24.454Z","repository":{"id":37529756,"uuid":"271044947","full_name":"aerni/statamic-factory","owner":"aerni","description":"Easily whip up fake content using Faker","archived":false,"fork":false,"pushed_at":"2024-09-11T21:28:55.000Z","size":289,"stargazers_count":19,"open_issues_count":4,"forks_count":4,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-27T01:11:12.640Z","etag":null,"topics":["faker","statamic","statamic-addon"],"latest_commit_sha":null,"homepage":"https://statamic.com/addons/aerni/factory","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/aerni.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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}},"created_at":"2020-06-09T15:49:46.000Z","updated_at":"2025-01-21T19:40:05.000Z","dependencies_parsed_at":"2024-09-12T02:29:57.101Z","dependency_job_id":"5e7778cc-4d64-4eaf-9b8b-c2d918337cad","html_url":"https://github.com/aerni/statamic-factory","commit_stats":{"total_commits":79,"total_committers":3,"mean_commits":"26.333333333333332","dds":"0.21518987341772156","last_synced_commit":"a7f0528f77445eb95c0348c985e5f3174bde0f51"},"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aerni%2Fstatamic-factory","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aerni%2Fstatamic-factory/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aerni%2Fstatamic-factory/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aerni%2Fstatamic-factory/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aerni","download_url":"https://codeload.github.com/aerni/statamic-factory/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243725077,"owners_count":20337660,"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":["faker","statamic","statamic-addon"],"created_at":"2024-10-11T18:54:50.398Z","updated_at":"2025-03-15T11:33:24.076Z","avatar_url":"https://github.com/aerni.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"![Statamic](https://flat.badgen.net/badge/Statamic/4.0+/FF269E) ![Packagist version](https://flat.badgen.net/packagist/v/aerni/factory/latest) ![Packagist Total Downloads](https://flat.badgen.net/packagist/dt/aerni/factory)\n\n# Factory\n\nThis addon provides an easy way to quickly whip up fake data for your `Collection Entries`, `Taxonomy Terms` and `Globals` using [Faker](https://github.com/FakerPHP/Faker).\n\n\n## Installation\nInstall the addon using Composer:\n\n```bash\ncomposer require aerni/factory\n```\n\nPublish the config of the package:\n\n```bash\nphp please vendor:publish --tag=factory-config\n```\n\nThe following config will be published to `config/factory.php`:\n\n```php\nreturn [\n\n    /*\n    |--------------------------------------------------------------------------\n    | Publish Status\n    |--------------------------------------------------------------------------\n    |\n    | The publish status of collection entries and taxonomy terms\n    | created by the factory.\n    |\n    | Tip: Randomize the status by setting this to '(bool) random_int(0, 1)'.\n    |\n    */\n\n    'published' =\u003e true,\n\n    /*\n    |--------------------------------------------------------------------------\n    | Title Fallback Settings\n    |--------------------------------------------------------------------------\n    |\n    | These title settings will function as a fallback to create titles for\n    | your collection entries and taxonomy terms, if you didn't explicitly set\n    | a 'title' field in the respective blueprint.\n    |\n    | 'chars': The character count of the title will be in this range.\n    | 'real_text': Use real english words instead of Lorem Ipsum.\n    |\n    */\n\n    'title' =\u003e [\n        'chars' =\u003e [$min = 20, $max = 30],\n        'real_text' =\u003e true,\n    ],\n\n];\n```\n\n## Basic Usage\n\nBefore you go crazy whipping up fake goodies, you need to let the Factory know what fields you want it to create. You do so by defining a `factory` key on each field in your blueprint that you want to fake. The value of the key is a Faker formatter for simple fieldtypes and an array of options for advanced fieldtypes like a grid. Please consult the [Faker Documentation](https://github.com/FakerPHP/Faker) for available formatters.\n\nThis is an example blueprint for a collection of people:\n```yaml\ntitle: Person\nsections:\n  main:\n    display: Main\n    fields:\n      -\n        handle: first_name\n        field:\n          type: text\n          factory: firstName\n      -\n        handle: last_name\n        field:\n          type: text\n          factory: lastName\n      -\n        handle: age\n        field:\n          type: number\n          factory: numberBetween(20, 50)\n      -\n        handle: bio\n        field:\n          type: textarea\n          factory: paragraph(3, true)\n```\n\nRun the factory in your terminal and follow the instructions:\n\n```bash\nphp please factory\n```\n\n## Special Fieldtypes\n\nThe above example works great for basic fieldtypes. But what about Bard, Replicator, Grid and Tables? I'm glad you asked. To fake content for these \"Special Fieldtypes\" you need to change the blueprint according to the examples below.\n\n### Bard \u0026 Replicator\n`min_sets` defines the minimum number of sets to create.\n`max_sets` defines the maximum number of sets to create.\n\n```yaml\ntitle: 'Bard \u0026 Replicator'\nsections:\n  main:\n    display: Main\n    fields:\n      -\n        handle: replicator\n        field:\n          type: replicator\n          sets:\n            text:\n              display: Text\n              factory:\n                min_sets: 1\n                max_sets: 3\n              fields:\n                -\n                  handle: text\n                  field:\n                    type: text\n                    factory: word\n                -\n                  handle: textarea\n                  field:\n                    type: textarea\n                    factory: 'paragraph(3, true)'\n\n```\n\n### Grid\n`min_rows` defines the minimum number of rows to create.\n`max_rows` defines the maximum number of rows to create.\n\n```yaml\ntitle: Table\nsections:\n  main:\n    display: Main\n    fields:\n      -\n        handle: grid\n        field:\n          type: grid\n          factory:\n            min_rows: 1\n            max_rows: 4\n          fields:\n            -\n              handle: first_name\n              field:\n                type: text\n                factory: firstName\n            -\n              handle: last_name\n              field:\n                type: text\n                factory: lastName\n```\n\n### Table\n`min_rows` defines the minimum number of rows you want to create.\n`max_rows` defines the maximum number of rows you want to create.\n`min_cells` defines the minimum number of cells you want to create.\n`max_cells` defines the maximum number of cells you want to create.\n`formatter` defines the faker formatter to use.\n\n```yaml\ntitle: Table\nsections:\n  main:\n    display: Main\n    fields:\n      -\n        handle: table\n        field:\n          type: table\n          factory:\n            min_rows: 1\n            max_rows: 3\n            min_cells: 3\n            max_cells: 5\n            formatter: word\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faerni%2Fstatamic-factory","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faerni%2Fstatamic-factory","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faerni%2Fstatamic-factory/lists"}