{"id":36388648,"url":"https://github.com/vicenterusso/laravel-table-structure","last_synced_at":"2026-01-11T15:06:05.297Z","repository":{"id":57077780,"uuid":"359624564","full_name":"vicenterusso/laravel-table-structure","owner":"vicenterusso","description":"Get table field information adding only a trait to the model. Supports caching","archived":false,"fork":false,"pushed_at":"2021-04-20T16:04:43.000Z","size":25,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-25T16:54:16.701Z","etag":null,"topics":["database","laravel","schema","table"],"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/vicenterusso.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-04-19T23:22:12.000Z","updated_at":"2021-04-20T16:07:24.000Z","dependencies_parsed_at":"2022-08-24T14:56:09.954Z","dependency_job_id":null,"html_url":"https://github.com/vicenterusso/laravel-table-structure","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/vicenterusso/laravel-table-structure","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vicenterusso%2Flaravel-table-structure","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vicenterusso%2Flaravel-table-structure/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vicenterusso%2Flaravel-table-structure/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vicenterusso%2Flaravel-table-structure/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vicenterusso","download_url":"https://codeload.github.com/vicenterusso/laravel-table-structure/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vicenterusso%2Flaravel-table-structure/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28309752,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-11T14:58:17.114Z","status":"ssl_error","status_checked_at":"2026-01-11T14:55:53.580Z","response_time":60,"last_error":"SSL_read: 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":["database","laravel","schema","table"],"created_at":"2026-01-11T15:06:04.542Z","updated_at":"2026-01-11T15:06:05.290Z","avatar_url":"https://github.com/vicenterusso.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Laravel Table Structure\n\n[![Latest Version on Packagist](https://img.shields.io/packagist/v/vicenterusso/laravel-table-structure.svg?style=flat-square)](https://packagist.org/packages/vicenterusso/laravel-table-structure)\n[![GitHub Tests Action Status](https://img.shields.io/github/workflow/status/vicenterusso/laravel-table-structure/run-tests?label=tests)](https://github.com/vicenterusso/laravel-table-structure/actions?query=workflow%3Arun-tests+branch%3Amaster)\n[![GitHub Code Style Action Status](https://img.shields.io/github/workflow/status/vicenterusso/laravel-table-structure/Check%20\u0026%20fix%20styling?label=code%20style)](https://github.com/vicenterusso/laravel-table-structure/actions?query=workflow%3A\"Check+%26+fix+styling\"+branch%3Amaster)\n\nThis package helps you to get information about your table fields adding only a `trait` to your model. You can also optionally cache the results.\n\n## Installation\n\nYou can install the package via composer:\n\n```bash\ncomposer require vicenterusso/laravel_table_structure\n```\n\nYou can publish the config file with:\n```bash\nphp artisan vendor:publish --provider=\"VRusso\\TableStructure\\TableStructureServiceProvider\" --tag=\"laravel_table_structure-config\"\n```\n\nThis is the contents of the published config file:\n\n```php\nreturn [\n\n    /*\n    |--------------------------------------------------------------------------\n    | Enable Cache\n    |--------------------------------------------------------------------------\n    |\n    | Enable or disable usage of cache for Schema queries.\n    |\n    */\n    'use_cache' =\u003e false,\n\n    /*\n    |--------------------------------------------------------------------------\n    | Cache Prefix\n    |--------------------------------------------------------------------------\n    |\n    | Custom prefix for cache keys. Avoid empty values\n    |\n    */\n    'cache_prefix' =\u003e env('TABLE_STRUCT_PREFIX', 'TABLE_STRUCT'),\n\n];\n```\n\n## Usage\n\nInsert the following trait to any model, and you can retrieve all info about the table fields\n\n```php\n# Add trait to model\nuse \\VRusso\\TableStructure\\Traits\\FieldsInfo;\n\n# Call it anywhere\nUser::hasField('username'); \n//true/false\n\nUser::getAllFields();\n//['username', 'password', ...]\n\nUser::getAllFieldsWithTypes();\n//[\n//    [\n//    'field' =\u003e 'username',\n//    'type' =\u003e 'string'\n//    ],\n//    (...)\n//]\n\nUser::getAllFieldsWithTypeOf('integer');\n//['id', ...]\n```\n\n## Credits\n\n- [Vicente Russo](https://github.com/vicenterusso)\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%2Fvicenterusso%2Flaravel-table-structure","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvicenterusso%2Flaravel-table-structure","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvicenterusso%2Flaravel-table-structure/lists"}