snicco/better-wpdb-bundle

v1.9.0 2023-09-20 12:36 UTC

README

codecov Psalm Type-Coverage Psalm level PhpMetrics - Static Analysis PHP-Versions

This WordPress bundle configures the standalone snicco/better-wpdb library for usage in applications based on snicco/kernel.

Installation

composer install snicco/better-wpdb-bundle

Configuration

This bundle has no configuration options currently.

Usage

Add the BetterWPDBBundle to your bundles.php configuration file.

<?php
// /path/to/configuration/bundles.php

use Snicco\Bundle\BetterWPDB\BetterWPDBBundle;

return [
    
    'bundles' => [
        Snicco\Component\Kernel\ValueObject\Environment::ALL => [
            BetterWPDBBundle::class
        ]   
    ]   
];

You can now lazily resolve a BetterWPDB instance from the booted kernel.

use Snicco\Component\BetterWPDB\BetterWPDB;
use Snicco\Component\Kernel\Kernel;

/**
* @var Kernel $kernel
*/
$kernel->boot();

$better_wpdb = $kernel->container()->make(BetterWPDB::class);

If an instance of QueryLogger is bound in the kernel container is will be used when creating the BetterWPDB instance. Otherwise, no queries will be logged.

Contributing

This repository is a read-only split of the development repo of the Snicco project.

This is how you can contribute.

Reporting issues and sending pull requests

Please report issues in the Snicco monorepo.

Security

If you discover a security vulnerability within BetterWPCache, please follow our disclosure procedure.