{"id":23453808,"url":"https://github.com/elsayed85/copilot-ask-database","last_synced_at":"2025-07-17T13:32:56.581Z","repository":{"id":236046355,"uuid":"695592994","full_name":"elsayed85/copilot-ask-database","owner":"elsayed85","description":null,"archived":false,"fork":false,"pushed_at":"2023-10-09T08:44:00.000Z","size":29,"stargazers_count":1,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-13T01:03:23.125Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/elsayed85.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","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}},"created_at":"2023-09-23T16:32:10.000Z","updated_at":"2023-09-24T17:06:18.000Z","dependencies_parsed_at":"2024-04-25T12:54:48.993Z","dependency_job_id":null,"html_url":"https://github.com/elsayed85/copilot-ask-database","commit_stats":null,"previous_names":["elsayed85/copilot-ask-database"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/elsayed85/copilot-ask-database","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elsayed85%2Fcopilot-ask-database","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elsayed85%2Fcopilot-ask-database/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elsayed85%2Fcopilot-ask-database/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elsayed85%2Fcopilot-ask-database/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/elsayed85","download_url":"https://codeload.github.com/elsayed85/copilot-ask-database/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elsayed85%2Fcopilot-ask-database/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265611110,"owners_count":23797814,"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":"2024-12-24T02:29:54.910Z","updated_at":"2025-07-17T13:32:56.562Z","avatar_url":"https://github.com/elsayed85.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Laravel Copilot Database Assistant\n\n[![Latest Version on Packagist](https://img.shields.io/packagist/v/elsayed85/copilot-ask-database.svg?style=flat-square)](https://packagist.org/packages/elsayed85/copilot-ask-database)\n[![GitHub Tests Action Status](https://img.shields.io/github/actions/workflow/status/elsayed85/copilot-ask-database/run-tests.yml?branch=main\u0026label=tests\u0026style=flat-square)](https://github.com/elsayed85/copilot-ask-database/actions?query=workflow%3Arun-tests+branch%3Amain)\n[![GitHub Code Style Action Status](https://img.shields.io/github/actions/workflow/status/elsayed85/copilot-ask-database/fix-php-code-style-issues.yml?branch=main\u0026label=code%20style\u0026style=flat-square)](https://github.com/elsayed85/copilot-ask-database/actions?query=workflow%3A\"Fix+PHP+code+style+issues\"+branch%3Amain)\n[![Total Downloads](https://img.shields.io/packagist/dt/elsayed85/copilot-ask-database.svg?style=flat-square)](https://packagist.org/packages/elsayed85/copilot-ask-database)\n\n## Installation\n\nYou can install the package via composer:\n\n```bash\ncomposer require elsayed85/copilot-ask-database \"dev-master\"\n```\n\nYou can publish the config file with:\n\n```bash\nphp artisan vendor:publish --tag=\"copilot-ask-database-config\"\n```\n\nThis is the contents of the published config file:\n\n```php\nreturn [\n    'github_token' =\u003e env('COPILOT_ASK_GITHUB_TOKEN'),\n\n    /**\n     * The database connection name to use. Depending on your\n     * use case, you might want to limit the database user\n     * to have read-only access to the database.\n     */\n    'connection' =\u003e env('COPILOT_ASK_CONNECTION', 'mysql'),\n\n    /**\n     * Strict mode will throw an exception when the query\n     * would perform a write/alter operation on the database.\n     *\n     * If you want to allow write operations - or if you are using a read-only\n     * database user - you may disable strict mode.\n     */\n    'strict_mode' =\u003e env('COPILOT_ASK_STRICT_MODE', true),\n\n    /**\n     * The maximum number of tables to use before performing an additional\n     * table name lookup call to OpenAI.\n     * If you have a lot of database tables and columns, they might not fit\n     * into a single request to OpenAI. In that case, we will perform a\n     * lookup call to OpenAI to get the matching table names for the\n     * provided question.\n     */\n    'max_tables_before_performing_lookup' =\u003e env('COPILOT_ASK_MAXIMUM_TABLES', 15),\n\n    'copilot' =\u003e [\n        'intent' =\u003e false,\n        'model' =\u003e 'copilot-chat', // Don't change this\n        'top_p' =\u003e 1,\n        'n' =\u003e 1,\n\n        'client_id' =\u003e '01ab8ac9400c4e429b23', // Don't change this\n        'user_agent' =\u003e 'GithubCopilot/3.99.99', // Don't change this\n    ],\n];\n```\n\nOptionally, you can publish the views using\n\n```bash\nphp artisan vendor:publish --tag=\"copilot-ask-database-views\"\n```\n\nViews Contains Prompts templates , you can customize it as you want.\n\n## Setup Github Copilot\n\n1. Authenticate with Github Copilot using code :\n```bash\nphp artisan copilot:github:auth\n```\n\n```text\nPlease visit the following URL and login with your Github account:\nhttps://github.com/login/device\nPlease enter the following code in the Github Device Activation page:\nYour Github auth code is: 0EFA-6762\n```\n\n2. Verify Github Copilot Authentication (After you login with your Github account and enter the code)\n```bash\nphp artisan copilot:github:verify\n```\n\n```text\nYour Github access token is: gho_6E8rRBDL.........................\nPlease add the following line to your .env file:\nCOPILOT_ASK_GITHUB_TOKEN=gho_6E8rRBDL.........................\n```\n\n3. Add Github Copilot Token to your .env file\n```dotenv\nCOPILOT_ASK_GITHUB_TOKEN=gho_6E8rRBDL.........................\n```\n\n## Usage\n\n### Ask For SQL Query\n\n```php\nuse Illuminate\\Support\\Facades\\DB;\n\n$question = 'How many users are there?';\n\n$query = DB::askCopilotForQuery($question);\n\n```\nAnswer \n```sql\nSELECT COUNT(*) FROM users\n```\n\n### Ask For Human Answer\n\n```php\nuse Illuminate\\Support\\Facades\\DB;\n\n$question = 'How many users are there?';\n\n$query = DB::askCopilot($question);\n\n```\nAnswer\n```text\nThere are 10 users.\n```\n\n\n\n## Testing\n\n```bash\ncomposer test\n```\n\n## Changelog\n\nPlease see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.\n\n## Contributing\n\nPlease see [CONTRIBUTING](CONTRIBUTING.md) for details.\n\n## Security Vulnerabilities\n\nPlease review [our security policy](../../security/policy) on how to report security vulnerabilities.\n\n## Credits\n\n- [Elsayed Kamal](https://github.com/elsayed85)\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%2Felsayed85%2Fcopilot-ask-database","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Felsayed85%2Fcopilot-ask-database","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felsayed85%2Fcopilot-ask-database/lists"}