How to get widget parameter in custom phtml or block?
use parameters in widget.xml
<parameters>
<parameter name="category_id" sort_order="10" visible="true" xsi:type="text">
<label>124</label>
</parameter>
</parameters>
you can get this value in .phtml like
<?php echo $block->getData('category_id'); ?>
hope this will work for you.
I used ObjectManager but using the below code you can convert.
<?php
use \Magento\Framework\App\Bootstrap;
require __DIR__ . '/app/bootstrap.php';
$bootstrap = Bootstrap::create(BP, $_SERVER);
$objectManager = $bootstrap->getObjectManager();
$instance = \Magento\Framework\App\ObjectManager::getInstance();
$state = $objectManager->get('\Magento\Framework\App\State');
$state->setAreaCode('frontend');
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$widgetCollection = $objectManager->create('Magento\Widget\Model\Widget\Instance');
//$data = $widgetCollection->load(instanceId);
$data = $widgetCollection->load('1');
echo "<pre/>";
print_r($data->getData());
Result