{"id":23524003,"url":"https://github.com/piyook/csvseeder","last_synced_at":"2025-09-25T11:42:02.856Z","repository":{"id":57678532,"uuid":"491129524","full_name":"piyook/csvseeder","owner":"piyook","description":"A simple Laravel utility package to seed database tables with CSV data using a custom Artisan command","archived":false,"fork":false,"pushed_at":"2022-05-13T08:37:22.000Z","size":19,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-17T00:50:26.278Z","etag":null,"topics":["artisan-command","csv","database","laravel","seeder"],"latest_commit_sha":null,"homepage":"","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/piyook.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":"2022-05-11T13:45:05.000Z","updated_at":"2022-05-11T14:22:43.000Z","dependencies_parsed_at":"2022-09-14T03:23:07.493Z","dependency_job_id":null,"html_url":"https://github.com/piyook/csvseeder","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/piyook%2Fcsvseeder","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/piyook%2Fcsvseeder/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/piyook%2Fcsvseeder/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/piyook%2Fcsvseeder/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/piyook","download_url":"https://codeload.github.com/piyook/csvseeder/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254083954,"owners_count":22011905,"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":["artisan-command","csv","database","laravel","seeder"],"created_at":"2024-12-25T18:13:33.443Z","updated_at":"2025-09-25T11:41:57.809Z","avatar_url":"https://github.com/piyook.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n\u003c!-- PROJECT LOGO --\u003e\n\u003cbr /\u003e\n\u003cp align=\"center\"\u003e\n\n  \u003ch3 align=\"center\"\u003eCSV Database Seeder Utility Service\u003c/h3\u003e\n\n  \u003cp align=\"center\"\u003e\n    A simple Laravel utility package to seed database tables with CSV data.\n    \u003cbr /\u003e\n    \u003ca href=\"https://github.com/piyook/laravelcsvseed\"\u003e\u003cstrong\u003eExplore the docs »\u003c/strong\u003e\u003c/a\u003e\n    \u003cbr /\u003e\n    \u003cbr /\u003e\n  \u003c/p\u003e\n\u003c/p\u003e\n\n\n\n\u003c!-- TABLE OF CONTENTS --\u003e\n\u003cdetails open=\"open\"\u003e\n  \u003csummary\u003e\u003ch2 style=\"display: inline-block\"\u003eTable of Contents\u003c/h2\u003e\u003c/summary\u003e\n  \u003col\u003e\n    \u003cli\u003e\n      \u003ca href=\"#about-the-project\"\u003eAbout The Project\u003c/a\u003e\n      \u003cul\u003e\n        \u003cli\u003e\u003ca href=\"#built-with\"\u003eBuilt With\u003c/a\u003e\u003c/li\u003e\n      \u003c/ul\u003e\n    \u003c/li\u003e\n    \u003cli\u003e\n      \u003ca href=\"#getting-started\"\u003eGetting Started\u003c/a\u003e\n      \u003cul\u003e\n        \u003cli\u003e\u003ca href=\"#prerequisites\"\u003ePrerequisites\u003c/a\u003e\u003c/li\u003e\n        \u003cli\u003e\u003ca href=\"#installation\"\u003eInstallation\u003c/a\u003e\u003c/li\u003e\n      \u003c/ul\u003e\n    \u003c/li\u003e\n    \u003cli\u003e\u003ca href=\"#usage\"\u003eUsage\u003c/a\u003e\u003c/li\u003e\n    \u003cli\u003e\u003ca href=\"#contact\"\u003eContact\u003c/a\u003e\u003c/li\u003e\n  \u003c/ol\u003e\n\u003c/details\u003e\n\n\u003cbr/\u003e\n\u003cbr/\u003e\n\n\u003c!-- ABOUT THE PROJECT --\u003e\n## About The Project\n\u003cbr/\u003e\nA simple utility for Laravel that allows a database to be quickly populated using data from a file in CSV format. \u003cbr/\u003e  \u003cbr/\u003e\n\nA custom Artisan make: command builds the CSV seeder class which then imports data from a CSV file stored in database/data folder.\n\u003cbr/\u003e\n\u003cbr/\u003e\n### Built With\n\n* Laravel 9   \n\u003cbr/\u003e\n\n## Getting Started\n\u003cbr/\u003e\nThe code can be added to a fresh Laravel install or an existing project.\n\u003cbr/\u003e\n\u003cbr/\u003e\n\n### Prerequisites\n\nLaravel 8+\n\u003cbr/\u003e\n\u003cbr/\u003e\n\n### Installation\n\u003cbr/\u003e\n\nInstall the package using composer \n\n```sh\n    composer require --dev piyook/csvseeder\n```\n\n\n\n## Usage\n\n\u003cbr/\u003e\nA custom Artisan make command was developed to make scaffolding a Seeder Class to import CSV files easier.\n\u003cbr/\u003e\u003cbr/\u003e\n\nThe CSV data file **must share the same name as the table and be stored in a database/data folder.**\u003cbr/\u003e\u003cbr/\u003e\n\nTo use the Artisan command simply type :\u003cbr/\u003e\u003cbr/\u003e\n\n ```sh\n  php artisan make:csvseeder \u003cname\u003e \u003ccolumns\u003e \u003cpath\u003e (optional)\n  ``` \n\u003cbr/\u003e\n\n\nWhere the table name to be seeded is passed to the make command along with an ARRAY of column names []. \n\u003cbr/\u003e\nNote that if the table name is plural then the singular form will be used for the class name\u003cbr/\u003e\u003cbr/\u003e\n\nIf the seeder class is to be stored in a location OTHER than database/seeders then you can specify this new path as the final option.\n\u003cbr/\u003e\n\n**E.g A new Seeder Class for a table called \"examples\" which will import from the \"examples.csv\" file held in database/data, will be saved to the database/seeders directory with the filename \"ExampleCSV.php\".** \u003cbr/\u003e\n\n\u003cbr/\u003e\n\n  ```sh\n    php artisan make:csvseeder examples [col1,col2,col3,col4]\n  ```\nthen \n\n  ```sh\n  php artisan migrate:fresh\n\n  php artisan db:seed --class=ExampleCSV\n  ``` \n  \u003cbr/\u003e\n\n**DONT FORGET TO REGISTER THE NEW CSV SEEDER IN THE DatabaseSeeder CLASS IN THE SEEDERS FOLDER BEFORE RUNNING A GENERAL DB SEED AS PART OF A MIGRATION WITH THE --SEED OPTION**\n\u003cbr/\u003e\n\u003cbr/\u003e\n\n## Testing\n\u003cbr/\u003e\n\nOrchestra Testbench would normally be used to run unit and feature tests in the package but the seeder function would not work (the seeder class was not found).\n\n\nA full seperate Laravel test project was set-up and the tests, phpunit.xml and the database/data, database/migration folders and files in the package test folder copied into the relevant places in the project to set up the test environment.\n\nAll Feature tests work running with Artisan test command.\n\n## Contact\n\n\u003cbr/\u003e\nEmail: piyook@piyook.com\n\u003cbr/\u003e\u003cbr/\u003e\nProject Link: \n[laravelcsvseed] \u003chttps://github.com/piyook/laravelcsvseed\u003e\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpiyook%2Fcsvseeder","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpiyook%2Fcsvseeder","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpiyook%2Fcsvseeder/lists"}