{"id":21865657,"url":"https://github.com/codesvault/howdy_qb","last_synced_at":"2026-01-04T10:17:10.097Z","repository":{"id":50064213,"uuid":"408024845","full_name":"CodesVault/howdy_qb","owner":"CodesVault","description":"MySQL Query Builder for WordPress","archived":false,"fork":false,"pushed_at":"2024-11-29T12:31:16.000Z","size":471,"stargazers_count":23,"open_issues_count":2,"forks_count":8,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-08-16T20:47:13.392Z","etag":null,"topics":["composer","composer-library","composer-package","database","mysql","pdo-mysql","pdo-php","php","query","query-builder","querybuilder","relational-databases","wordpress","wordpress-development","wordpress-php-library"],"latest_commit_sha":null,"homepage":"https://wp-querybuilder.pages.dev","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/CodesVault.png","metadata":{"files":{"readme":"README.md","changelog":null,"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}},"created_at":"2021-09-19T03:47:53.000Z","updated_at":"2025-06-15T12:50:41.000Z","dependencies_parsed_at":"2024-11-10T14:23:18.169Z","dependency_job_id":"d5f2e311-f1c7-48ad-864b-e84754ea58d2","html_url":"https://github.com/CodesVault/howdy_qb","commit_stats":{"total_commits":76,"total_committers":1,"mean_commits":76.0,"dds":0.0,"last_synced_commit":"cc04ae4886380fb301710bdc12a1a3111d64c3ab"},"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"purl":"pkg:github/CodesVault/howdy_qb","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CodesVault%2Fhowdy_qb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CodesVault%2Fhowdy_qb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CodesVault%2Fhowdy_qb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CodesVault%2Fhowdy_qb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CodesVault","download_url":"https://codeload.github.com/CodesVault/howdy_qb/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CodesVault%2Fhowdy_qb/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271430856,"owners_count":24758402,"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","status":"online","status_checked_at":"2025-08-21T02:00:08.990Z","response_time":74,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["composer","composer-library","composer-package","database","mysql","pdo-mysql","pdo-php","php","query","query-builder","querybuilder","relational-databases","wordpress","wordpress-development","wordpress-php-library"],"created_at":"2024-11-28T04:17:21.826Z","updated_at":"2026-01-04T10:17:10.092Z","avatar_url":"https://github.com/CodesVault.png","language":"PHP","readme":"# WP Query Builder\n\u003cp\u003e\nRelational Database Query builder for WordPress.\nWP Query Builder uses \u003ccode\u003ePDO\u003c/code\u003e for database queries. It has \u003cstrong\u003ezero dependencies\u003c/strong\u003e with third-party query builders or any other composer library.\n\u003c/p\u003e\n\n\u003cbr/\u003e\n\n# Documentation\nDocumentation website [here](https://wp-querybuilder.pages.dev/).\n\u003cbr/\u003e\nThis Query Builder is also used in [Kathamo](https://kathamo.dev) Framework. Kathamo is a modern framework for WordPress plugin development.\n\n### Installation:\n\n```\ncomposer require codesvault/howdy-qb\n```\n\n\u003cbr/\u003e\n\n## Examples\n\n### Create Table\n``` php\nDB::create('querybuilder')\n\t-\u003ecolumn('ID')-\u003ebigInt()-\u003eunsigned()-\u003eautoIncrement()-\u003eprimary()-\u003erequired()\n\t-\u003ecolumn('user_id')-\u003ebigInt()-\u003eunsigned()-\u003erequired()\n\t-\u003ecolumn('name')-\u003estring(255)-\u003erequired()\n\t-\u003ecolumn('email')-\u003estring(255)-\u003enullable()\n\t-\u003ecolumn('settings')-\u003eenum(['active', 'inactive'])\n\t-\u003ecolumn('created_at')-\u003etimestamp('now', 'current')\n\t-\u003eforeignKey('user_id', 'users.ID', 'cascade')\n\t-\u003eindex(['ID'])\n\t-\u003eexecute();\n```\n\n\u003cbr/\u003e\n\n### Insert Statement\n``` php\nDB::insert('querybuilder', [\n    [\n        'name' =\u003e 'Keramot UL Islam',\n        'email' =\u003e 'keramotul.@gmail.com',\n    ]\n]);\n```\n\n\u003cbr/\u003e\n\n### Update Statement\n\n``` php\nDB::update('querybuilders', [\n    'name' =\u003e 'Keramot UL',\n    'email' =\u003e 'keramotul.islam@gmail.com'\n])\n-\u003ewhere('ID', '=', 10)\n-\u003eandWhere('name', '=', 'Abm Sourav')\n-\u003eexecute();\n```\n\n\u003cbr\u003e\n\n### Select Statement\n\n``` php\n$result =\nDB::select('qb.ID', 'qb.name, qb.email')\n    -\u003efrom('querybuilders')\n    -\u003ealias('qb')\n    -\u003egroupBy('name')\n    -\u003eget();\n\n// *** where clouse\n$result =\nDB::select('posts.ID', 'posts.post_title')\n    -\u003edistinct()\n    -\u003efrom('posts posts')\n    -\u003ewhere('posts.post_status', '=', 'publish')\n    -\u003eorderBy('post_title', 'DESC')\n    -\u003elimit(10)-\u003eoffset(2)\n    -\u003eget();\n\n// *** JOIN\nDB::select('users.display_name name')\n    -\u003ecount('posts.ID', 'posts')\n    -\u003efrom('users users')\n    -\u003ejoin('posts posts')\n    -\u003ewhere('posts.post_status', '=', 'publish')\n    -\u003eandWhere('posts.post_type', '=', 'post')\n    -\u003eget();\n\n// raw sql\nDB::select('posts.post_title')\n    -\u003efrom('posts posts')\n    -\u003eraw(\"WHERE posts.post_type = 'post'\")\n    -\u003eandWhere('posts.post_status', '=', 'publish')\n    -\u003eraw(\"LIMIT 10\")\n    -\u003eget();\n```\n\n\u003cbr\u003e\n\n#### Sub Query\n\n``` php\nDB::select('*')\n\t-\u003efrom('querybuilder')\n\t-\u003ewhereIn('age', function ($subQuery) {\n\t\t$subQuery-\u003eselect('age')\n\t\t-\u003efrom('users')\n\t\t-\u003ewhere('country', '=', 'Bangladesh');\n\t})\n\t-\u003eandWhere('name', '\u003c\u003e', 'Keramot')\n\t-\u003eget();\n```\n\n\u003cbr\u003e\n\n### Delete Statement\n\n``` php\n// delete one row\nDB::delete('posts')\n    -\u003ewhere('ID', '=', 3)\n    -\u003eexecute();\n\n// delete all records\nDB::delete('posts')-\u003eexecute();\n```\n\n\u003cbr\u003e\n\n### Drop Statement\n\n``` php\nDB::drop('posts');\nDB::dropIfExists('terms');\n```\n\n\u003cbr\u003e\n\n### Alter Statement\n\n``` php\nDB::alter('cv_users')\n    -\u003emodify('name', 'username')-\u003estring(455)-\u003erequired()\n    -\u003emodify('settings')-\u003ejson()\n    -\u003eexecute();\n```\n\n\u003cbr\u003e\n\u003cbr\u003e\n\n### Single instence\n\u003cp\u003e\nExpressions also can be exicuted with one instence of \u003ccode\u003eDB\u003c/code\u003e class. By doing this database connection will be stablished only once.\n\u003c/p\u003e\n\n``` php\n$db = new DB();\n\n$result =\n$db::select('posts.ID', 'posts.post_title')\n    ...\n\n$db::create('meta')\n    ...\n```\n\n\u003cbr\u003e\n\u003cbr\u003e\n\n### Database Connection\nBy default database connection will set out of the box, automaically. But you can also manually input database configurations. This way, you also can debug your database queries from terminal.\n\n```php\n$db = DB::setConnection(\n\t[\n\t\t\"dbhost\"        =\u003e 'mysql_host',\n\t\t\"dbname\"        =\u003e 'database_name',\n\t\t\"dbuser\"        =\u003e 'database_user',\n\t\t\"dbpassword\"    =\u003e 'database_password',\n\t\t\"prefix\"        =\u003e 'database_table_prefix'\n\t]\n);\n```\n\n\u003cbr\u003e\n\u003cbr\u003e\n\n### Driver\n\nThe default driver is `pdo`. But if you want to use `wpdb` which uses Mysqli, you also can do that by changing the driver.\n``` php\n$db = new DB('wpdb');\n\n$db::select('posts.post_title')\n    -\u003efrom('posts posts')\n    -\u003eget();\n```\n\n\u003cbr\u003e\n\u003cbr\u003e\n\n## Dev Envirenment Setup for Contributors\nWant to contribute to this package? Please follow the steps below.\n\n\u003cul\u003e\n    \u003cli\u003eCreate a local WordPress envirenment setup.\u003c/li\u003e\n    \u003cli\u003eCreate a basic plugin.\u003c/li\u003e\n    \u003cli\u003eRun \u003ccode\u003ecomposer init\u003c/code\u003e into the plugin.\u003c/li\u003e\n    \u003cli\u003eClone \u003ccode\u003egit@github.com:CodesVault/howdy_qb.git\u003c/code\u003e into plugin folder.\u003c/li\u003e\n    \u003cli\u003e\n        Add repository for local package in plugin's \u003ccode\u003ecomposer.json\u003c/code\u003e.\n        \u003cpre\u003e\n\"repositories\": [\n\t{\n\t\t\"type\": \"path\",\n\t\t\"url\": \"./howdy_qb\",\n\t\t\"options\": {\n\t\t\t\"symlink\": true\n\t\t}\n\t}\n],\n        \u003c/pre\u003e\n    \u003c/li\u003e\n    \u003cli\u003eRequire this package. \u003ccode\u003ecomposer require \"codesvault/howdy-qb @dev\"\u003c/code\u003e\u003c/li\u003e\n\u003c/ul\u003e\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodesvault%2Fhowdy_qb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodesvault%2Fhowdy_qb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodesvault%2Fhowdy_qb/lists"}