leadvertex / plugin-component-info
This package is abandoned and no longer maintained.
No replacement package was suggested.
LeadVertex plugin information component
Package info
github.com/leadvertex/plugin-component-info
pkg:composer/leadvertex/plugin-component-info
0.1.6
2022-01-19 20:27 UTC
Requires
- php: >=7.4
- ext-json: *
- leadvertex/plugin-component-translations: ^0.1.2
- xakepehok/enum-helper: ^0.1.0
Requires (Dev)
- phpunit/phpunit: ^9.0
README
\Leadvertex\Plugin\Components\Info\Info- component for represent information about plugin developer\Leadvertex\Plugin\Components\Info\Developer- component for represent information about plugin itself
Installation
composer require leadvertex/plugin-component-info
Configuration
$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', 'support@starkindustries.com', '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 );
Usage
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