PHP code example of humweb / widgets
1. Go to this page and download the library: Download humweb/widgets 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/ */
humweb / widgets example snippets
php
$widgets = new WidgetFactory();
$widgets->register('foo', function($val = '') {
return 'bar'.$val;
});
echo $widgets->foo('baz');
php
$widgets = new WidgetFactory();
$widgets->register('foo', 'Humweb\Widgets\Tests\Fake\FooWidget@render');
// or
// $widgets->register('foo', 'Humweb\Widgets\Tests\Fake\FooWidget');
// Check for registered widget
$this->widgets->has('foo');
// Renders
echo $this->widgets->foo();