{"id":13615060,"url":"https://github.com/rymanalu/factory-generator","last_synced_at":"2025-12-13T02:41:26.413Z","repository":{"id":62538665,"uuid":"85916595","full_name":"rymanalu/factory-generator","owner":"rymanalu","description":"Laravel 5 Model Factory Generator","archived":false,"fork":false,"pushed_at":"2017-09-02T17:54:40.000Z","size":9,"stargazers_count":17,"open_issues_count":3,"forks_count":4,"subscribers_count":2,"default_branch":"1.0","last_synced_at":"2025-02-19T06:20:19.607Z","etag":null,"topics":["factory","laravel","laravel-model","model"],"latest_commit_sha":null,"homepage":null,"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/rymanalu.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-03-23T06:50:22.000Z","updated_at":"2023-01-26T13:14:15.000Z","dependencies_parsed_at":"2022-11-02T16:15:24.475Z","dependency_job_id":null,"html_url":"https://github.com/rymanalu/factory-generator","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rymanalu%2Ffactory-generator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rymanalu%2Ffactory-generator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rymanalu%2Ffactory-generator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rymanalu%2Ffactory-generator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rymanalu","download_url":"https://codeload.github.com/rymanalu/factory-generator/tar.gz/refs/heads/1.0","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248777981,"owners_count":21160068,"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":["factory","laravel","laravel-model","model"],"created_at":"2024-08-01T20:01:08.885Z","updated_at":"2025-12-13T02:41:21.383Z","avatar_url":"https://github.com/rymanalu.png","language":"PHP","funding_links":[],"categories":["Laravel","Packages"],"sub_categories":["Database/Eloquent/Models"],"readme":"# Laravel 5 Model Factory Generator\n\nThis package offers a lazy way to create a new model factory files, since Laravel (\u003c 5.5) have no Artisan command to generate it.\n\n## Installation\nFirst, install this package via the Composer package manager:\n```\ncomposer require rymanalu/factory-generator\n```\n\nNext, you should add the `FactoryGeneratorServiceProvider` to the `providers` array of your `config/app.php` configuration file:\n```php\nRymanalu\\FactoryGenerator\\FactoryGeneratorServiceProvider::class,\n```\nNow, you should be able to generate a new model factory file by executing `php artisan make:factory` command.\n\n## Usage\n`php artisan make:factory` accept one argument: the model class name with the namespace. Make sure the model is already exists before executing this command.\n\nExample:\n\n```\nphp artisan make:factory \"App\\Post\"\n```\nThe command will generate a file named `PostFactory.php` in `/path/to/your-laravel-project/database/factories` directory:\n\n```php\n\u003c?php\n\nuse App\\Post;\nuse Faker\\Generator as Faker;\n\n$factory-\u003edefine(Post::class, function (Faker $faker) {\n    //\n});\n```\nThis command also using the fillable array of the model and pair all of fillable values to `$faker-\u003eword` as default (you can change it to the proper [Faker](https://github.com/fzaninotto/Faker) Formatters or other value later) in the generated model factory.\n\nFor example, if the `App\\Post` has fillable array like this:\n```php\n\u003c?php\n\nnamespace App;\n\nuse Illuminate\\Database\\Eloquent\\Model;\n\nclass Post extends Model\n{\n    /**\n     * The attributes that are mass assignable.\n     *\n     * @var array\n     */\n    protected $fillable = [\n        'text',\n    ];\n}\n```\nThen, the command will generate the `PostFactory.php` like this:\n```php\n\u003c?php\n\nuse App\\Post;\nuse Faker\\Generator as Faker;\n\n$factory-\u003edefine(Post::class, function (Faker $faker) {\n    return [\n        'text' =\u003e $faker-\u003eword,\n    ];\n});\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frymanalu%2Ffactory-generator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frymanalu%2Ffactory-generator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frymanalu%2Ffactory-generator/lists"}