{"id":40631950,"url":"https://github.com/phpple/altable","last_synced_at":"2026-01-21T07:37:20.651Z","repository":{"id":57040745,"uuid":"146690720","full_name":"phpple/altable","owner":"phpple","description":"Altable用来对通过mysqldump出来的表结构数据进行解析，分析出数据库、数据表、字段、主键、索引等信息。","archived":false,"fork":false,"pushed_at":"2021-12-03T04:45:01.000Z","size":23,"stargazers_count":7,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-26T07:40:33.537Z","etag":null,"topics":[],"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/phpple.png","metadata":{"files":{"readme":"README.MD","changelog":null,"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":"2018-08-30T03:27:49.000Z","updated_at":"2022-01-21T01:17:26.000Z","dependencies_parsed_at":"2022-08-23T23:30:44.572Z","dependency_job_id":null,"html_url":"https://github.com/phpple/altable","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/phpple/altable","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phpple%2Faltable","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phpple%2Faltable/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phpple%2Faltable/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phpple%2Faltable/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/phpple","download_url":"https://codeload.github.com/phpple/altable/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phpple%2Faltable/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28629915,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-21T04:47:28.174Z","status":"ssl_error","status_checked_at":"2026-01-21T04:47:22.943Z","response_time":86,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":"2026-01-21T07:37:20.584Z","updated_at":"2026-01-21T07:37:20.634Z","avatar_url":"https://github.com/phpple.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"Phpple Altable\n================\n\n本项目用来对通过mysqldump出来的表结构数据进行解析，分析出数据库、数据表、字段、主键、索引等信息。\n\n[![Latest Stable Version](https://img.shields.io/packagist/v/phpple/altable.svg?style=flat-square)](https://packagist.org/packages/phpple/altable)\n[![Minimum PHP Version](https://img.shields.io/badge/php-%3E%3D%205.6-8892BF.svg?style=flat-square)](https://php.net/)\n[![Build Status](https://img.shields.io/travis/phpple/altable/master.svg?style=flat-square)](https://travis-ci.org/phpple/altable)\n[![codecov](https://codecov.io/gh/phpple/altable/branch/master/graph/badge.svg)](https://codecov.io/gh/phpple/altable)\n\n## 使用步骤\n\ncomposer引入项目\n```bash\ncomposer require phpple/altable\n```\n\n通过mysqldump导出需要的表结构：\n```bash\nmysqldump --all-databases --no-data \u003e dump.sql\n```\n\n\n编写php脚本分析数据库结构\n```php\n\u003c?php\nrequire 'vendor/autoload.php';\n\n$parser = new Phpple\\Altable\\Parser();\n// 设定不需要分析哪些库或者表\n$parser-\u003edbFilters = [\n    // 整个库不予分析\n    'mysql' =\u003e null,\n    // foo.bar不予分析\n    'foo' =\u003e ['bar'],\n];\n$dbs = $parser-\u003eparse(__DIR__.'/dump.sql');\n\n// 开始进行分析\nforeach($dbs as $db) {\n    foreach($db-\u003etables as $table) {\n        foreach($table-\u003efields as $field) {\n            if ($field-\u003ename == 'uid') {\n                echo \"`{$db-\u003ename}`.`{$table-\u003ename}` found uid field\";\n            }\n        }\n    }\n}\n\n// 通过名称查找名称为foo的DB\n$parser-\u003efind($dbs, 'foo');\n\n// 通过名称查找名称为foo.bar的Table\n$parser-\u003efind($dbs, 'foo', 'bar');\n\n// 通过名称查找表foo.bar里的字段uid\n$parser-\u003efind($dbs, 'foo', 'bar', 'uid');\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphpple%2Faltable","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fphpple%2Faltable","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphpple%2Faltable/lists"}