{"id":25470312,"url":"https://github.com/thinkphp/csv2service","last_synced_at":"2025-11-04T18:30:33.913Z","repository":{"id":1196647,"uuid":"1103306","full_name":"thinkphp/csv2service","owner":"thinkphp","description":"A PHP script using YQL that turns any CSV file into a search and filter web interface.","archived":false,"fork":false,"pushed_at":"2010-11-23T09:36:19.000Z","size":104,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-04-14T14:54:23.864Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://thinkphp.ro/apps/php-hacks/csv2service/","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/thinkphp.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}},"created_at":"2010-11-22T19:37:26.000Z","updated_at":"2020-10-02T03:51:36.000Z","dependencies_parsed_at":"2022-08-16T12:31:18.897Z","dependency_job_id":null,"html_url":"https://github.com/thinkphp/csv2service","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thinkphp%2Fcsv2service","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thinkphp%2Fcsv2service/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thinkphp%2Fcsv2service/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thinkphp%2Fcsv2service/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thinkphp","download_url":"https://codeload.github.com/thinkphp/csv2service/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239437463,"owners_count":19638503,"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":[],"created_at":"2025-02-18T08:32:53.458Z","updated_at":"2025-11-04T18:30:33.833Z","avatar_url":"https://github.com/thinkphp.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"csvtoservice\n============\nIs a PHP script to pull data from a CSV file on the web and turn it into a search and filter interface.\n\nThe parameters and options\n-----------------------------\n\nAll you need to provide is a URL that points to a CSV file and the script does the rest.\nYou assign a variable to the main function that will get the HTML as properties.\n\n\n     #PHP\n     $myservice = csvtoservice('http://winterolympicsmedals.com/medals.csv');\n\nThe returned properties will be:\n\n- **$myservice['form']** the HTML form with all possible fields contained in the dataset.\n- **$myservice['table']** the data table of the information returned by the form submission.\n- **$myservice['query']** the data in raw JSON (for debugging).\n- **$myservice['json']** the YQL statement (for debugging).\n\nIf you want to tweak the outcome of the form and the table and you want to change the data names or remove parts of it \nyou can set and options array:\n\n     #PHP\n     include('csvtoservice.php');\n     $content = csvtoservice('http://winterolympicsmedals.com/medals.csv',\n          array(\n             'filter' =\u003e array(fieldnames),\n             'rename' =\u003e array('field' =\u003e 'new field'),\n             'preset' =\u003e array('field' =\u003e preset value),\n             'prefill' =\u003e array('field1' =\u003e 'value1',\n                                'field2' =\u003e 'value 2'),\n             'uppercase' =\u003e Boolean            \n          )  \n     ); \n\n- **filter** contains an array of fields to not show in the form or the table. This allows you to get rid of some of the data.\n- **rename** allows you to rename fields.\n- **preset** is an array of fields to preset with a hard value. This fields will be part of the query of the data, but will not be added to the form or displayed. This allows you to pre-filter the data.\n- **prefill** is an array of fields to pre-fill the form in case you want to give the end user a hint what they can search for.\n- **uppercase** - is a boolean value if the script should uppercase the first letter of the field name or not ex:('Country' instead of 'country').\n\n\n## Sample\n\n    #PHP\n    include('csvtoservice.php');\n    $content = csvtoservice('http://winterolympicsmedals.com/medals.csv',\n       array(\n           'filter' =\u003e array('eventgender', 'city'),\n           'rename' =\u003e array('noc' =\u003e 'country'),\n           'preset' =\u003e array('year' =\u003e 2002),\n           'prefill' =\u003e array('sport' =\u003e 'skiing',\n                              'medal' =\u003e 'gold'),\n           'uppercase' =\u003e true  \n          )  \n       ); \n    if($content) {\n       if($content['form']) {\n          echo$content['form']; \n       }\n       if($content['table']) {\n          echo$content['table']; \n       } \n    } \n\n\nYou can view in action:\n\n- [http://thinkphp.ro/apps/php-hacks/csv2service/](http://thinkphp.ro/apps/php-hacks/csv2service/)\n- [http://thinkphp.ro/apps/php-hacks/csv2service/demo.php](http://thinkphp.ro/apps/php-hacks/csv2service/demo.php) \n- [http://thinkphp.ro/apps/php-hacks/csv2service/demo-with-logging.php](http://thinkphp.ro/apps/php-hacks/csv2service/demo-with-logging.php)\n- [http://thinkphp.ro/apps/php-hacks/csv2service/fifa2010.php](http://thinkphp.ro/apps/php-hacks/csv2service/fifa2010.php)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthinkphp%2Fcsv2service","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthinkphp%2Fcsv2service","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthinkphp%2Fcsv2service/lists"}