{"id":27958311,"url":"https://github.com/91ahmed/csvtosql","last_synced_at":"2025-05-07T18:21:57.884Z","repository":{"id":49167980,"uuid":"517178974","full_name":"91ahmed/CsvtoSql","owner":"91ahmed","description":"Convert a csv file into optimized sql insert statement.","archived":false,"fork":false,"pushed_at":"2025-02-22T10:51:19.000Z","size":179,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-22T11:27:52.396Z","etag":null,"topics":["csv","csv-converter","csvtosql","php","sql"],"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/91ahmed.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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-07-23T22:42:38.000Z","updated_at":"2025-02-22T10:51:42.000Z","dependencies_parsed_at":"2025-02-05T15:27:09.739Z","dependency_job_id":null,"html_url":"https://github.com/91ahmed/CsvtoSql","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/91ahmed%2FCsvtoSql","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/91ahmed%2FCsvtoSql/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/91ahmed%2FCsvtoSql/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/91ahmed%2FCsvtoSql/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/91ahmed","download_url":"https://codeload.github.com/91ahmed/CsvtoSql/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252931820,"owners_count":21827172,"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-converter","csvtosql","php","sql"],"created_at":"2025-05-07T18:21:57.173Z","updated_at":"2025-05-07T18:21:57.872Z","avatar_url":"https://github.com/91ahmed.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"**CsvtoSql** is a class that converts CSV files into SQL INSERT statements, making it easy to import data into databases like MySQL, PostgreSQL, and SQLite.\n\n### Install via composer\n``` bash\ncomposer require csv/csvtosql\n```\n\n### Example\n``` php\n// Import vendor autoload\nrequire ('vendor/autoload.php'); \n\n// Example\n$csv = new Csv\\Csvtosql\\TransformCsv();\n$csv-\u003efile('files/sales.csv') // Source csv file\n    -\u003etable('salse') // Target table name\n    -\u003etransform()\n    -\u003eexportSQL('transform/sales.sql'); // Destination (output the sql file with insert statement)\n```\n\n### Methods Description\n1- ``` file() ``` \u003cbr/\u003e\n\u003e Specify the source csv file path you need to transform.\n``` php\n// @param string (csv source file path)\nfile('folder/file.csv');\n```\n\n2- ``` table() ``` \u003cbr/\u003e\n\u003e Set the target table name; the first CSV row is used as column names.\n``` php\n// @param string (table name)\ntable('tablename');\n```\n\n3- ``` transform() ``` \u003cbr/\u003e\n\u003e Extract data from (csv) and transform it to (sql).\n\n4- ``` exportSQL() ``` \u003cbr/\u003e\n\u003e Generate a new SQL file containing the transformed data as well-structured INSERT statements, ready for integration into your database.\n``` php\n// @param string (new sql file destination)\nexportSQL('exported/file.sql');\n```\n\n## Contributing\nContributions are welcome! Please fork the repository and submit a pull request.\n\n## License\nThis project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.\n\nBy incorporating these sections, the `README.md` will provide a comprehensive overview of the CsvtoSql library, guiding users from installation to implementation effectively. \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F91ahmed%2Fcsvtosql","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F91ahmed%2Fcsvtosql","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F91ahmed%2Fcsvtosql/lists"}