Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spatie Ignition for Debugging #256

Merged
merged 11 commits into from
Dec 5, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions mu-plugins/000-wp-ignition-loader.php
darylldoyle marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php
/**
* Plugin Name: WP Ignition
* Description: Adds Laravel Ignition to WordPress to aid with debugging.
* Version: 1.0.0
* Author: 10up
* Author URI: https://10up.com/
* License: GPL v2 or later
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
* Text Domain: wp-ignition
* Update URI: https://yourwebsite.com/wp-ignition
darylldoyle marked this conversation as resolved.
Show resolved Hide resolved
* Requires at least: 5.0
* Requires PHP: 8.0
*
* @package WP_Ignition
*/

// Don't load in production or if WP_DEBUG is disabled.
if ( 'production' === wp_get_environment_type() || false === WP_DEBUG ) {
return;
}

require_once __DIR__ . '/wp-ignition/wp-ignition.php';
14 changes: 14 additions & 0 deletions mu-plugins/wp-ignition/composer.json
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question: why not include this is a dev dependency in the root composer.json so it's one less composer.json file. When running --production it won't be loaded and then the plugin code would never run

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I played with that idea a bunch. Unfortunately we'd need to load our autoloader in WP-config.php or something, otherwise it doesn't load early enough.

Our current MU plugin loads the autoloader late in the WP boot process and we want it to load as the first plugin, to ensure all errors are handled by Ignition

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think wp-config.php is the best place to load this to be honest. The repo could have a wp-config-sample.php

Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"name": "10up/wp-ignition",
"type": "wordpress-plugin",
darylldoyle marked this conversation as resolved.
Show resolved Hide resolved
"authors": [
{
"name": "10up",
"email": "[email protected]"
}
],
"require": {
"php": ">=8.0",
"spatie/ignition": "^1.15"
}
}
Loading