{"id":15016878,"url":"https://github.com/coderflexx/laravel-csv","last_synced_at":"2025-04-12T10:42:15.522Z","repository":{"id":59598397,"uuid":"524375711","full_name":"coderflexx/laravel-csv","owner":"coderflexx","description":"This Package created on top of Laravel livewire for easily handling CSV imports with a simple API.","archived":false,"fork":false,"pushed_at":"2025-04-07T13:17:46.000Z","size":858,"stargazers_count":64,"open_issues_count":3,"forks_count":7,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-07T14:27:31.443Z","etag":null,"topics":["csv","csv-import","laravel","livewire"],"latest_commit_sha":null,"homepage":"https://github.com/coderflexx/laravel-csv-demo","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/coderflexx.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2022-08-13T11:09:47.000Z","updated_at":"2025-04-07T13:17:43.000Z","dependencies_parsed_at":"2024-09-24T20:41:24.476Z","dependency_job_id":null,"html_url":"https://github.com/coderflexx/laravel-csv","commit_stats":{"total_commits":108,"total_committers":6,"mean_commits":18.0,"dds":"0.40740740740740744","last_synced_commit":"55f572f15c0287d09142999dd9a15ea6f709c5c4"},"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coderflexx%2Flaravel-csv","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coderflexx%2Flaravel-csv/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coderflexx%2Flaravel-csv/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coderflexx%2Flaravel-csv/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/coderflexx","download_url":"https://codeload.github.com/coderflexx/laravel-csv/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248557148,"owners_count":21124156,"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":["csv","csv-import","laravel","livewire"],"created_at":"2024-09-24T19:49:30.811Z","updated_at":"2025-04-12T10:42:15.483Z","avatar_url":"https://github.com/coderflexx.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n    \u003cimg src=\"art/logo.png\" alt=\"Laravisit Logo\" width=\"300\"\u003e\n    \u003cbr\u003e\u003cbr\u003e\n\u003c/p\u003e\n\n[![Latest Version on Packagist](https://img.shields.io/packagist/v/coderflex/laravel-csv.svg?style=flat-square)](https://packagist.org/packages/coderflex/laravel-csv)\n[![GitHub Tests Action Status](https://img.shields.io/github/actions/workflow/status/coderflexx/laravel-csv/run-tests.yml?branch=main\u0026label=tests)](https://github.com/coderflexx/laravel-csv/actions?query=workflow%3Arun-tests+branch%3Amain)\n[![GitHub Code Style Action Status](https://img.shields.io/github/actions/workflow/status/coderflexx/laravel-csv/phpstan.yml?branch=main\u0026label=code%20style)](https://github.com/coderflexx/laravel-csv/actions?query=workflow%3A\"Fix+PHP+code+style+issues\"+branch%3Amain)\n[![Total Downloads](https://img.shields.io/packagist/dt/coderflex/laravel-csv.svg?style=flat-square)](https://packagist.org/packages/coderflex/laravel-csv)\n\n\n- [Introduction](#introduction)\n- [Installation](#installation)\n- [Configuration](#configuration)\n- [Usage](#usage)\n  - [CSV Importer Component](#csv-importer-component)\n  - [Button Component](#button-component)\n  - [In TALL stack project](#in-tall-stack-project)\n  - [In none TALL Stack project](#in-none-tall-stack-project)\n  - [Using Queues](#using-queues)\n- [Testing](#testing)\n- [Changelog](#changelog)\n- [Contributing](#contributing)\n- [Security Vulnerabilities](#security-vulnerabilities)\n- [Inspiration](#inspiration)\n- [Credits](#credits)\n- [License](#license)\n\n## Introduction\n__Laravel CSV__ Package is a package created on top of Laravel [livewire](https://laravel-livewire.com) for easily handling imports with a simple API.\n\n## Installation\n\nYou can install the package via composer:\n\n```bash\ncomposer require coderflex/laravel-csv\n```\n\n## Configuration\n\nPublish and run the migrations with:\n\n```bash\nphp artisan vendor:publish --tag=\"csv-migrations\"\nphp artisan migrate\n```\n\nAdd trait **HasCsvImports** to your User model.\n\nPublish the config file with:\n\n```bash\nphp artisan vendor:publish --tag=\"csv-config\"\n```\n\nThe following is the contents of the published config file:\n\n```php\n\nreturn [\n\n    /*\n    |--------------------------------------------------------------------------\n    | Default Layout\n    |--------------------------------------------------------------------------\n    |\n    | This package plans on supporting multiple CSS frameworks. \n    | Currently, 'tailwindcss' is the default and only supported framework.\n    |\n    */\n    'layout' =\u003e 'tailwindcss',\n\n    /*\n    |--------------------------------------------------------------------------\n    | Max Upload File Size\n    |--------------------------------------------------------------------------\n    |\n    | The default maximumum file size that can be imported by this\n    | package is 20MB. If you wish to increase/decrease this value, \n    | change the value in KB below.\n    |\n    */\n    'file_upload_size' =\u003e 20000,\n];\n```\n\nThe `layout` option is for choosing which CSS framework you are using and currently supports only `tailwindcss`. We are working on other CSS frameworks to implement in the future.\n\nThe `file_upload_size` is for validation rules, and it defines the maximum file size of uploaded files. You may also define this value from the [livewire config](https://github.com/livewire/livewire/blob/master/config/livewire.php#L100) file.\n\nOptionally, you can publish the views using\n\n```bash\nphp artisan vendor:publish --tag=\"laravel-csv-views\"\n```\n\n\u003e Before Using this command, please take a look at this [section](#in-tall-stack-project) below.\n\n## Usage\n\n### CSV Importer Component\nUsing this package is a breeze. To implement the importer in your project, simply include the following component inside a Blade view.\n\n```blade\n    \u003clivewire:csv-importer :model=\"App\\Models\\YourModel::class\"\n                            :columns-to-map=\"['id', 'name', 'email', 'password']\"\n                            :required-columns=\"['id', 'name', 'email']\"\n                            :columns-label=\"[\n                                'id' =\u003e 'ID',\n                                'name' =\u003e 'Name',\n                                'email' =\u003e 'Email Address',\n                                'password' =\u003e 'Password',\n                            ]\"/\u003e\n```\n\n| Props  | Type  |  Description  |\n|---|---|---|\n|  model |`string` | Fully qualified name of the model you wish to import to  |\n|  columns-to-map |`array` | Column names in the target database table |\n|  required-columns |`array` | Columns that are required by validation for import  |\n| columns-label  |`array` |  Display labels for the required columns  |\n\n### Button Component\nThe Component uses `alpinejs` under the hood. To display an import button, include the `x-csv-button` component.\n\n```blade\n\u003cx-csv-button\u003eImport\u003c/x-csv-button\u003e\n```\n\nTo style the button, use the `class` attribute with Tailwind utility classes.\n\n```blade\n\u003cx-csv-button \n        class=\"rounded py-2 px-3 bg-indigo-500 ...\"\n        type=\"button\"\n        ....\u003e\n    {{ __('Import') }}\n\u003c/x-csv-button\u003e\n```\n### In TALL stack project\nIf you are using this package in a [TALL Stack](https://tallstack.dev/) project, (Tailwindcss, Alpinejs, Laravel, Livewire) publish the vendor views to include Laravel-CSV in your project.\n\n```bash\nphp artisan vendor:publish --tag=\"csv-views\"\n```\nThen compile your assets.\n```bash\nnpm run dev\n```\n\n### In none TALL Stack project\nIf you are not using the TALL Stack, use the `csv directives` to add the necessary styles/scripts.\n\n```blade\n\u003chtml\u003e\n    ...\n    \u003chead\u003e\n        ...\n        @csvStyles\n    \u003c/head\u003e\n        ...\n    \u003cfooter\u003e\n        ...\n        @csvScripts\n    \u003c/footer\u003e\n\u003c/html\u003e\n\n```\n### Using Queues\nThis package uses [queues](https://laravel.com/docs/9.x/queues#main-content) under the hood with [PHP Generators](https://www.php.net/manual/en/language.generators.overview.php) to make it fast and efficient.\n\nCreate the `batches table` by running\n```bash\nphp artisan queue:batches-table\n```\nThen, run the migration.\n```\nphp artisan migrate\n```\n\nAfter that, set up the queues' configuration.\nHead to [Laravel Queues Documentation](https://laravel.com/docs/9.x/queues#main-content) to learn more.\n\n\n## Testing\n\n```bash\ncomposer test\n```\n\n## Changelog\n\nPlease see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.\n\n## Contributing\n\nPlease see [CONTRIBUTING](https://github.com/ousid/.github/blob/main/CONTRIBUTING.md) for details.\n\n## Security Vulnerabilities\n\nPlease review [our security policy](../../security/policy) on how to report security vulnerabilities.\n\n## Inspiration\nThis Package Was Inspired by [codecourse](https://codecourse.com) video series. If you want to learn how this package was created, make sure to take a look at this [video series](https://codecourse.com/subjects/laravel-livewire)\n\n## Credits\n\n- [ousid](https://github.com/ousid)\n- [All Contributors](../../contributors)\n\n## License\n\nThe MIT License (MIT). Please see [License File](LICENSE.md) for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoderflexx%2Flaravel-csv","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcoderflexx%2Flaravel-csv","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoderflexx%2Flaravel-csv/lists"}