Automattic\WooCommerce\Utilities

StringUtil::plugin_name_from_plugin_file()public staticWC 1.0

Get the name of a plugin in the form 'directory/file.php', as in the keys of the array returned by 'get_plugins'.

{} It's a method of the class: StringUtil{}

No Hooks.

Return

String. The name of the plugin in the form 'directory/file.php'.

Usage

$result = StringUtil::plugin_name_from_plugin_file( $plugin_file_path ): string;
$plugin_file_path(string) (required)
The path of the main plugin file (can be passed as __FILE__ from the plugin itself).

Code of StringUtil::plugin_name_from_plugin_file() WC 7.1.0

public static function plugin_name_from_plugin_file( string $plugin_file_path ): string {
	return basename( dirname( $plugin_file_path ) ) . DIRECTORY_SEPARATOR . basename( $plugin_file_path );
}