humweb/widgets

Widgets package

1.2 2015-07-17 02:57 UTC

This package is auto-updated.

Last update: 2024-11-29 04:14:25 UTC


README

Build Status Scrutinizer Code Quality Code Coverage SensioLabsInsight Total Downloads Latest Version on Packagist Software License

Install

Via Composer

$ composer require humweb/widgets

Usage

Register anonymous function handler

$widgets = new WidgetFactory();

$widgets->register('foo', function($val = '') {
    return 'bar'.$val;
});

echo $widgets->foo('baz');

Register class handler

$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();

Change log

Please see CHANGELOG for more information what has changed recently.

Testing

$ composer test

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email ryun@humboldtweb.com instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.