{"id":26107288,"url":"https://github.com/khalidmh/eloquent-sql","last_synced_at":"2026-02-17T21:02:11.260Z","repository":{"id":267046159,"uuid":"861070888","full_name":"KhalidMh/eloquent-sql","owner":"KhalidMh","description":"EloquentSQL is a Laravel package that generates raw SQL insert queries from Eloquent model records with ease. Ideal for debugging, logging, or exporting data, it transforms model data into ready-to-use SQL statements.","archived":false,"fork":false,"pushed_at":"2024-12-13T14:43:21.000Z","size":51,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-22T10:30:01.923Z","etag":null,"topics":["database","laravel","mysql","php"],"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/KhalidMh.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","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,"zenodo":null}},"created_at":"2024-09-21T23:22:46.000Z","updated_at":"2024-12-13T14:43:25.000Z","dependencies_parsed_at":null,"dependency_job_id":"df0199a6-1120-4b8b-ac27-e07d28892e01","html_url":"https://github.com/KhalidMh/eloquent-sql","commit_stats":null,"previous_names":["khalidmh/eloquent-sql"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/KhalidMh/eloquent-sql","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KhalidMh%2Feloquent-sql","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KhalidMh%2Feloquent-sql/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KhalidMh%2Feloquent-sql/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KhalidMh%2Feloquent-sql/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/KhalidMh","download_url":"https://codeload.github.com/KhalidMh/eloquent-sql/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KhalidMh%2Feloquent-sql/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29558100,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-17T20:52:40.164Z","status":"ssl_error","status_checked_at":"2026-02-17T20:48:10.325Z","response_time":100,"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","mysql","php"],"created_at":"2025-03-09T22:53:02.199Z","updated_at":"2026-02-17T21:02:11.233Z","avatar_url":"https://github.com/KhalidMh.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# EloquentSQL\n\nEloquentSQL is a Laravel package that generates raw SQL insert queries from Eloquent model records. This package makes it easy to convert your Eloquent models into raw SQL insert statements, which can be useful for debugging, logging, exporting data, or batch insert operations.\n\n## 🚀 Features\n\n- Converts Eloquent model data into raw SQL insert statements\n- Ability to exclude / include specific columns\n- Easy to use with any Laravel Eloquent model\n- Ideal for debugging, logging, or data migration\n\n## 📦 Requirements\n\n- PHP 7.3 or higher\n- Laravel 8.x or higher\n\n## 🛠 Installation\n\nYou can install the package via Composer:\n\n```bash\ncomposer require khalidmh/eloquent-sql\n```\n\n## 📦 Usage\n\n### Generating Insert Query for a Model\n\n```PHP\n\nuse KhalidMh\\EloquentSQL\\EloquentSQL;\nuse App\\Models\\User;\n\n$user = User::find(1);\n$sql = EloquentSQL::set($user)-\u003etoQuery();\n\n// Output: INSERT INTO `users` (`id`, `name`, `email`, ...) VALUES (1, 'John Doe', 'john@example.com', ...);\n````\n\n### Excluding Columns\n\n### Specify which columns to be excluded from the insert query\n\n```PHP\n\nuse KhalidMh\\EloquentSQL\\EloquentSQL;\nuse App\\Models\\User;\n\n$user = User::find(1);\n\n$sql = EloquentSQL::set($user)\n        -\u003eexcept(['id', 'created_at', 'updated_at'])\n        -\u003etoQuery();\n\n\n// Output: INSERT INTO `users` (`name`, `email`, ...) VALUES ('John Doe', 'john@example.com', ...);\n```\n\n### Including Columns\n\n### Specify which columns to be in the insert query\n\n```PHP\n\nuse KhalidMh\\EloquentSQL\\EloquentSQL;\nuse App\\Models\\User;\n\n$user = User::find(1);\n\n$sql = EloquentSQL::set($user)\n        -\u003eonly(['name', 'email'])\n        -\u003etoQuery();\n\n\n// Output: INSERT INTO `users` (`name`, `email`) VALUES ('John Doe', 'johnjohn@example.com');\n```\n\n### Including hidden model attributes\n\n### By default Laravel removes hidden attributes from the Model based on the $hidden property, you can use the includeHidden() to add them to the insert query without updating the Model's $hidden property globaly.\n\n```PHP\n\nuse KhalidMh\\EloquentSQL\\EloquentSQL;\nuse App\\Models\\User;\n\n$user = User::find(1);\n\n$sql = EloquentSQL::set($user)\n        -\u003eincludeHidden()\n        -\u003eonly(['password', 'remember_token'])\n        -\u003etoQuery();\n\n// Output: INSERT INTO `users` (`password`, `remember_token`) VALUES ('password', '8zfuGf0f....');\n```\n\n## ⚙️ Configuration\n\nNo additional configuration is required. EloquentSQL works out-of-the-box with your existing Eloquent models.\n\n## 📃 License\n\nEloquentSQL is open-source software licensed under the [MIT license](LICENSE).\n\n## 🤝 Contributing\n\nContributions are welcome! Please feel free to submit a pull request or open an issue.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkhalidmh%2Feloquent-sql","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkhalidmh%2Feloquent-sql","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkhalidmh%2Feloquent-sql/lists"}