{"id":21207273,"url":"https://github.com/jeidison/native-query","last_synced_at":"2025-03-14T23:23:18.736Z","repository":{"id":56997841,"uuid":"204369603","full_name":"jeidison/native-query","owner":"jeidison","description":"Laravel package for save native query in external file.","archived":false,"fork":false,"pushed_at":"2023-03-03T15:51:19.000Z","size":26,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-22T15:03:22.409Z","etag":null,"topics":["laravel","php","sql"],"latest_commit_sha":null,"homepage":"","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/jeidison.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-08-26T01:04:43.000Z","updated_at":"2023-03-23T21:06:00.000Z","dependencies_parsed_at":"2025-01-21T15:55:03.683Z","dependency_job_id":null,"html_url":"https://github.com/jeidison/native-query","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jeidison%2Fnative-query","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jeidison%2Fnative-query/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jeidison%2Fnative-query/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jeidison%2Fnative-query/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jeidison","download_url":"https://codeload.github.com/jeidison/native-query/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243659360,"owners_count":20326657,"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":["laravel","php","sql"],"created_at":"2024-11-20T20:58:16.729Z","updated_at":"2025-03-14T23:23:18.716Z","avatar_url":"https://github.com/jeidison.png","language":"PHP","readme":"\n\n# Installation\n\n```bash\n$ composer require jeidison/native-query\n```\n\n# Publish Settings\n\n```bash\n$ php artisan vendor:publish --provider=\"Jeidison\\NativeQuery\\Provider\\NativeQueryServiceProvider\"\n```\nThis will add the nativequery.php file in your config directory with the following contents:\n\n```php\nreturn [\n    'path-sql' =\u003e database_path('native-query'),\n    'type' =\u003e Jeidison\\NativeQuery\\Enums\\FileType::PHP,\n];\n```\nAnd this will add the native-query.xml file in your database directory with the following contents:\n\n# SQL in file XML\n\n```xml\n\u003cquery name=\"findTab1\"\u003e\n    SELECT * FROM TAB1 WHERE PAR1 = ?\n\u003c/query\u003e\n```\n\nAnd this will add the native-query.php file in your database directory with the following contents:\n# SQL in file PHP\n\n```php\nCONST findTab1 = \"\nSELECT * FROM TAB1 WHERE PAR1 = :par1\n\";\n```\n# Add Trait in model\n\n```php\n...\n\nclass ModelX extends Model\n{\n    use HasNativeQuery;\n    \n    protected $queryFile = '/path/file-with-queries';\n\n    ...\n}\n```\n\n# Executing SQL\n\n```php\nModelX::nativeQuery('findTab1')-\u003eparam('par1', 'value1')-\u003eparam('par2', 'value2')-\u003eexec();\n\nModelX::nativeQuery('findTab1')-\u003eparam(['par1' =\u003e 'value1'])-\u003eexec();\n\nModelX::nativeQuery('findTab1')-\u003eparam(['par1' =\u003e 'value1'])-\u003e-\u003edebug();\n\nNativeQuery::query('findTab1')\n            -\u003equeryFile('/path/file-with-queries')\n            -\u003eparam('par1', 'value1')\n            -\u003eexec();\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjeidison%2Fnative-query","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjeidison%2Fnative-query","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjeidison%2Fnative-query/lists"}