PHP code example of leadvertex / plugin-component-info

1. Go to this page and download the library: Download leadvertex/plugin-component-info library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

leadvertex / plugin-component-info example snippets


$type = new \Leadvertex\Plugin\Components\Info\PluginType(PluginType::MACROS);

//PluginPurpose shown only for example 
//@see https://github.com/leadvertex/plugin-component-purpose
$purpose = new PluginPurpose(
    new PluginClass(PluginClass::CLASS_EXPORTER),
    new PluginEntity(PluginEntity ::ENTITY_ORDER),
);

$developer = new \Leadvertex\Plugin\Components\Info\Developer(
    'Tony Stark', 
    '[email protected]', 
    'starkindustries.com'
);

$info = \Leadvertex\Plugin\Components\Info\Info::config(
    $type,
    'Excel',
    'This plugin can be used for export your orders to Excel',
    $purpose,
    $developer
);

//Info name and description also can be a callable
$info = \Leadvertex\Plugin\Components\Info\Info::config(
    $type,
    fn() => 'Excel',
    fn() => 'This plugin can be used for export your orders to Excel',
    $purpose,
    $developer
);

echo Info::getInstance()->getName();           //print "Excel", also for callable
echo Info::getInstance()->getDescription();    //print "This plugin can be used for export your orders to Excel", also for callable 

$extra = Info::getInstance()->getExtra();
$developer = Info::getInstance()->getDeveloper();

echo json_encode(Info::getInstance());         //can be serialized into JSON