https://github.com/williarin/wordpress-simple-queries
WordPress plugin that allows to use WordpressInterop lib to query the database
https://github.com/williarin/wordpress-simple-queries
dbal wordpress wordpress-database wordpress-development wordpress-plugin
Last synced: 6 months ago
JSON representation
WordPress plugin that allows to use WordpressInterop lib to query the database
- Host: GitHub
- URL: https://github.com/williarin/wordpress-simple-queries
- Owner: williarin
- License: other
- Created: 2022-07-20T06:25:31.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2022-08-06T09:21:44.000Z (over 3 years ago)
- Last Synced: 2025-02-26T19:48:28.148Z (11 months ago)
- Topics: dbal, wordpress, wordpress-database, wordpress-development, wordpress-plugin
- Language: PHP
- Homepage:
- Size: 19.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# Simple Queries
## Introduction
This WordPress plugin integrates [williarin/wordpress-interop](https://github.com/williarin/wordpress-simple-queries) in WordPress.
## Requirements
You must have WordPress 5.6 or later running on PHP 8.0 or later.
## Installation
Download the latest release on this page and extract it in `yourproject/wp-content/plugins/simple-queries/`.
**Warning:** WordPress Plugin Directory doesn't host plugins made for developers anymore.
This is to avoid that an admin user deactivate or delete the plugin as he doesn't see the use of it.
Ideally, you would require the library directly using composer, so you wouldn't have to install this plugin.
However, there are some cases where this plugin might come in useful, particularly if you don't have composer in your WordPress installation.
## Usage
Once the plugin is activated, you'll be able to use the `SimpleQuery()` function which gives you the `EntityManager`.
For more details, see [williarin/wordpress-interop](https://github.com/williarin/wordpress-interop) documentation.
Example:
```php
use Williarin\SimpleQueries\Vendor\Williarin\WordpressInterop\Bridge\Entity\Product;
if (!defined('SIMPLE_QUERIES_ENABLED') || !SIMPLE_QUERIES_ENABLED) {
return;
}
// Fetch all products with id and sku columns only
$products = SimpleQuery()->getRepository(Product::class)
->findBy([new SelectColumns(['id', 'sku'])]);
```
## License
[GPL 3.0](LICENSE.txt)
Copyright (c) 2022, William Arin