Skip to content

Access the Wordpress Database via the Sledgehammer ORM

Notifications You must be signed in to change notification settings

sledgehammer/wordpress

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

41 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sledgehammer Wordpress

Adds Sledgehammer goodies

  • DebugR intergration (includes the wpdb query log).
  • Statusbar
  • PDO database access.
  • ORM access to wordpress models

Devutils

  • Export Post - An post_id independend export of an wp_posts record.
  • Diff options - Compare diffences in the contents of the wp_options table.

Installation

Install with composer, in the root of the wordpress project run:

composer require sledgehammer/wordpress

Edit wp-config.php and add at the bottom (after the require wp-settings.php):

require_once(ABSPATH.'vendor/autoload.php');
Sledgehammer\Wordpress\Bridge::initialize();
require_once(ABSPATH.'vendor/sledgehammer/core/src/render_public_folders.php');

Disable web access to the vendor folder.
(For Apache httpd: Add a .httaccess file into the vendor folder with Deny from all)

Configuration

The bridge looks at constants defined in the wp-config to auto-configure sledgehammer.

WP_DEBUG: Enable the errorhandler & statusbar
SAVEQUERIES: Enables the sql query log
DB_*: Connect to the database, if needed
WP_HOME: Detect public folder

To measure initialization add the following line line at the beginning of the wp-config.php:

define('Sledgehammer\STARTED', microtime(true));

About

Access the Wordpress Database via the Sledgehammer ORM

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages