Skip to content

Instantly share code, notes, and snippets.

@djcowan
Created February 6, 2026 02:27
Show Gist options
  • Select an option

  • Save djcowan/550a180f4a972eac4c1d5b0b603d57c4 to your computer and use it in GitHub Desktop.

Select an option

Save djcowan/550a180f4a972eac4c1d5b0b603d57c4 to your computer and use it in GitHub Desktop.
basic wordpress plugin.php bootstrap file
<?php
declare(strict_types=1);
namespace imageDirect\*_NA;
/**
* Plugin name: imageDirect *_NA
*
* Plugin URI: <https://www.imagedirect.com.au/>
* Description: imageDirect *_NA - Get found in the noise.
* Requires at least: 6.0
* Requires PHP: 8.0
* Version: 1.0.0
* Author: imageDirect
* Author URI: <https://www.imagedirect.com.au/>
* License: GPL-3.0-or-later
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
* Contributors: imageDirect WebTeam
* Text Domain: imagedirect-*_NA
* ------------------------------------- */
defined('ABSPATH') || exit;
/**
* Class
* @since 1.0.0
* @version 1.0.0
* ------------------------------------- */
class App
{
public array $package = [
'version'=>'',
'slug'=>''
];
/**
* @since 1.0.0
* @version 1.0.0
* ------------------------------------- */
public function __construct()
{
// $this->package['slug'] = \sanitize_title(\basename(__FILE__, '.php'));
$this->package['slug'] = (string) \sanitize_title(\basename(__DIR__));
$this->package['version'] = (string) \substr(\md5((string) \filemtime(__FILE__)), 0, 8);
}
/**
* @since 1.0.0
* @version 1.0.0
* ------------------------------------- */
public function run(): void
{
// start
}
}
/**
* Static
*
* @since 1.0.0
* @version 1.0.0
* ------------------------------------- */
function app(): App
{
static $App;
if (null !== $App) {
return $App;
}
$App = new App();
return $App;
}
\add_action(
'plugins_loaded',
function () {
app()->run();
},
100
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment