Add class as plugin for other plugins

You can check if the class is already include / exists, and if it not exists include it.

In your plugin, depending on how you can be sure that the install has plugin activated, you’ll maybe need to include your class inw every plugin.

 if(!class_exists('Excel_Writer'){
    include_once('excelwriter.inc.php');
    $excel = new Excel_Writer('myxls.xls');
 }

Be carefull with files paths.

If you really want to include your file only in one plugin, the main plugin (with the required file) must be load first.

Then the other plugin will be able to find and work with the class.

You can add some code to desactivate “sub” plugins if the main is not available with is_plugin_active

Hope it gives you some hints to help you !