PHP code example of librenms / plugin-interfaces

1. Go to this page and download the library: Download librenms/plugin-interfaces 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/ */

    

librenms / plugin-interfaces example snippets


    public function boot(): void
    {
        $pluginName = 'example-plugin';
        $pluginManager = $this->app->make(\LibreNMS\Interfaces\Plugins\PluginManagerInterface::class);

        $pluginManager->publishHook($pluginName, \LibreNMS\Interfaces\Plugins\MenuEntryHook::class, MenuEntryHook::class);

        if (! $pluginManager->pluginEnabled($pluginName)) {
            return; // if plugin is disabled, don't boot
        }

        // Do regular Laravel Package actions here, such as register routes and views or publish files.
    }