{"id":19972352,"url":"https://github.com/mateodioev/db","last_synced_at":"2025-05-04T01:30:48.572Z","repository":{"id":62525014,"uuid":"463760767","full_name":"Mateodioev/db","owner":"Mateodioev","description":null,"archived":false,"fork":false,"pushed_at":"2023-04-22T02:09:17.000Z","size":31,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-04-08T01:01:38.929Z","etag":null,"topics":["mysql","pdo","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/Mateodioev.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":"2022-02-26T05:16:21.000Z","updated_at":"2022-09-05T10:44:35.000Z","dependencies_parsed_at":"2024-11-13T03:07:49.179Z","dependency_job_id":"25dab6ed-69e0-4fcf-838c-374492449bad","html_url":"https://github.com/Mateodioev/db","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mateodioev%2Fdb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mateodioev%2Fdb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mateodioev%2Fdb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mateodioev%2Fdb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Mateodioev","download_url":"https://codeload.github.com/Mateodioev/db/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252276955,"owners_count":21722447,"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":["mysql","pdo","php","sql"],"created_at":"2024-11-13T03:07:45.843Z","updated_at":"2025-05-04T01:30:48.227Z","avatar_url":"https://github.com/Mateodioev.png","language":"PHP","readme":"# Easy sql-connection\n[![CodeFactor](https://www.codefactor.io/repository/github/mateodioev/db/badge)](https://www.codefactor.io/repository/github/mateodioev/db)\n\n## Installation\n\nGithub:\n```bash\ngit clone https://github.com/Mateodioev/db\ncd db\ncomposer install\n```\n\nComposer:\n```bash\ncomposer require mateodioev/db\n```\n\n\n## Usage\n\nSet database data\n```php\nuse Mateodioev\\Db\\Connection;\n\nConnection::Prepare('DB_HOST', 'DB_PORT', 'DB_NAME', 'DB_USER', 'DB_PASS');\n# or \n$dir = 'path/to/.env/file';\nConnection::PrepareFromEnv($dir);\n```\n\nExecute querys\n```php\nuse Mateodioev\\Db\\Query;\n$db = new Query();\n\n// Return one afect row\n$db-\u003eExec('SELECT * FROM users'); // Simple sql query\n$db-\u003eExec('SELECT * FROM users WHERE id = :id', [':id' =\u003e 'random_id']); // With params\n\n// Return all afect rows\n$db-\u003eGetAll('SELECT * FROM users'); // Simple sql query\n$db-\u003eGetAll('SELECT * FROM users WHERE id = :id', [':id' =\u003e 'random_id']); // With params\n```\n\n\n## Exceptions\n\n- `Connection::PrepareFromEnv($dir);` If dir not fund or not readable throw exception\n\n- `$db-\u003eExec($sql_query)` or `$db-\u003eGetAll($sql_query)` If sql query not valid or invalid credentials throw exception\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmateodioev%2Fdb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmateodioev%2Fdb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmateodioev%2Fdb/lists"}