{"id":19433185,"url":"https://github.com/ssnepenthe/wpdb-engine-for-latitude","last_synced_at":"2026-07-02T14:04:44.716Z","repository":{"id":57699108,"uuid":"492961749","full_name":"ssnepenthe/wpdb-engine-for-latitude","owner":"ssnepenthe","description":"Build queries for wpdb using the latitude query builder","archived":false,"fork":false,"pushed_at":"2023-01-18T22:16:20.000Z","size":29,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-07-26T20:33:49.168Z","etag":null,"topics":["toy","wordpress"],"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/ssnepenthe.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}},"created_at":"2022-05-16T18:52:24.000Z","updated_at":"2022-07-09T16:53:23.000Z","dependencies_parsed_at":"2023-02-10T18:30:43.038Z","dependency_job_id":null,"html_url":"https://github.com/ssnepenthe/wpdb-engine-for-latitude","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/ssnepenthe/wpdb-engine-for-latitude","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ssnepenthe%2Fwpdb-engine-for-latitude","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ssnepenthe%2Fwpdb-engine-for-latitude/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ssnepenthe%2Fwpdb-engine-for-latitude/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ssnepenthe%2Fwpdb-engine-for-latitude/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ssnepenthe","download_url":"https://codeload.github.com/ssnepenthe/wpdb-engine-for-latitude/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ssnepenthe%2Fwpdb-engine-for-latitude/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273973588,"owners_count":25200575,"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-09-06T02:00:13.247Z","response_time":2576,"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":["toy","wordpress"],"created_at":"2024-11-10T14:38:43.024Z","updated_at":"2026-07-02T14:04:44.672Z","avatar_url":"https://github.com/ssnepenthe.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# wpdb-engine-for-latitude\n\nUse the [latitude](https://github.com/shadowhand/latitude) query builder to build queries for use in `wpdb`.\n\n## Warning\n\nThis package is currently in development and is subject to breaking changes without notice until v1.0 has been tagged.\n\nIt is one in a series of [WordPress toys](https://github.com/ssnepenthe?tab=repositories\u0026q=topic%3Atoy+topic%3Awordpress\u0026type=\u0026language=\u0026sort=) I have been working on with the intention of exploring ways to modernize the feel of working with WordPress.\n\nAs the label suggests, it should be treated as a toy.\n\n\n## Installation\n\n```sh\ncomposer require ssnepenthe/wpdb-engine-for-latitude\n```\n\n## Usage\n\nStart by reviewing the [latitude documentation](https://latitude.shadowhand.com/). Using this package will be largely the same.\n\nThe important differences are noted below:\n\n### WpdbEngine\n\nThe engine provided to the query factory should always be an instance of `WpdbEngine`:\n\n```php\nuse Latitude\\QueryBuilder\\QueryFactory;\nuse WpdbEngineForLatitude\\WpdbEngine;\n\n$factory = new QueryFactory(new WpdbEngine());\n```\n\n### Field Function\n\nIn place of the `Latitude\\QueryBuilder\\field()` function, use `WpdbEngineForLatitude\\field()`:\n\n```php\nuse function WpdbEngineForLatitude\\field;\n\n$query = $factory\n    -\u003eselect('id', 'username')\n    -\u003efrom('users')\n    -\u003ewhere(field('id')-\u003eeq(5))\n    -\u003ecompile();\n```\n\n### Search Function\n\nIn place of the `Latitude\\QueryBuilder\\search()` function, use `WpdbEngineForLatitude\\search()`:\n\n```php\nuse function WpdbEngineForLatitude\\search;\n\n$query = $factory\n    -\u003eselect()\n    -\u003efrom('users')\n    -\u003ewhere(search('first_name')-\u003ebegins('john'))\n    -\u003ecompile();\n```\n\n## With Wpdb\n\nOnce you have compiled a query instance you should pass the sql and params through the `wpdb-\u003eprepare()` method to get your final query string:\n\n```php\nglobal $wpdb;\n\n$queryString = $wpdb-\u003eprepare($query-\u003esql(), ...$query-\u003eparams());\n```\n\nAnd finally use it with any of the `wpdb` query methods:\n\n```php\n$result = $wpdb-\u003eget_row($queryString);\n```\n\n## More Examples\n\nPlease refer to the tests in `tests/CodeReferenceExamplesTest.php` - The examples from the [`wpdb` code reference page](https://developer.wordpress.org/reference/classes/wpdb/) have been re-implemented there.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fssnepenthe%2Fwpdb-engine-for-latitude","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fssnepenthe%2Fwpdb-engine-for-latitude","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fssnepenthe%2Fwpdb-engine-for-latitude/lists"}