https://github.com/humweb/widgets
Widgets component
https://github.com/humweb/widgets
Last synced: 6 months ago
JSON representation
Widgets component
- Host: GitHub
- URL: https://github.com/humweb/widgets
- Owner: humweb
- License: mit
- Created: 2015-06-24T08:53:20.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2025-03-16T19:23:51.000Z (over 1 year ago)
- Last Synced: 2025-10-21T17:55:54.861Z (9 months ago)
- Language: PHP
- Homepage: http://humboldtweb.com
- Size: 18.6 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Widgets
[](https://travis-ci.org/humweb/widgets)
[](https://scrutinizer-ci.com/g/humweb/widgets/?branch=master)
[](https://scrutinizer-ci.com/g/humweb/widgets/?branch=master)
[](https://insight.sensiolabs.com/projects/b3b19bb7-3d29-44ac-ba51-d83723b10a6f)
[](https://packagist.org/packages/humweb/widgets)
[](https://packagist.org/packages/humweb/widgets)
[](LICENSE.md)
## Install
Via Composer
``` bash
$ composer require humweb/widgets
```
## Usage
**Register anonymous function handler**
``` php
$widgets = new WidgetFactory();
$widgets->register('foo', function($val = '') {
return 'bar'.$val;
});
echo $widgets->foo('baz');
```
**Register class handler**
``` 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();
```
## Change log
Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.
## Testing
``` bash
$ composer test
```
## Contributing
Please see [CONTRIBUTING](CONTRIBUTING.md) for details.
## Security
If you discover any security related issues, please email ryun@humboldtweb.com instead of using the issue tracker.
## Credits
- [Ryan Shofner](https://github.com/ryun)
- [All Contributors](../../contributors)
## License
The MIT License (MIT). Please see [License File](LICENSE.md) for more information.