homevrs/wp-libs

There is no license information available for the latest version (1.0.0) of this package.

Djia WP Libs

1.0.0 2025-01-18 21:34 UTC

This package is not auto-updated.

Last update: 2025-09-20 11:00:12 UTC


README

Some custom functions for my plugins Container for WP plugins. Example of usage

$registry = [
	Request::class => static fn(): Request => Request::createFromGlobals(),
	wpdb::class => static function(): wpdb {
		global $wpdb;
		return $wpdb;
	},
	'plugin_file' => static fn(): string => __FILE__,
	'plugin_path' => static fn(): string => plugin_dir_path(__FILE__),
	'plugin_url' => static fn(): string => plugin_dir_url(__FILE__),
];

$container = Container::createInstance($registry);
/* @var MainPluginClass $main */
$main = $container->get(MainPluginClass::class);