https://github.com/humweb/thingamabob
https://github.com/humweb/thingamabob
Last synced: 6 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/humweb/thingamabob
- Owner: humweb
- License: mit
- Created: 2022-07-22T07:14:29.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2025-03-16T19:15:58.000Z (over 1 year ago)
- Last Synced: 2025-03-16T20:28:04.223Z (over 1 year ago)
- Language: PHP
- Size: 52.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Thingamabob Widget Manager
[](https://github.com/humweb/thingamabob/actions/workflows/run-tests.yml)
[](https://github.com/humweb/thingamabob/actions/workflows/phpstan.yml)
[](https://github.com/humweb/thingamabob/actions/workflows/php-cs-fixer.yml)
## Installation
You can install the package via composer:
```bash
composer require humweb/thingamabob
```
You can publish and run the migrations with:
```bash
php artisan vendor:publish --tag="thingamabob-migrations"
php artisan migrate
```
You can publish the config file with:
```bash
php artisan vendor:publish --tag="thingamabob-config"
```
This is the contents of the published config file:
```php
return [
'route' => '/api/widgets',
'middleware' => [],
'assets_path' => resource_path('js/widgets/'),
];
```
## Usage
#### Register new widget
```php
Widgets::resgister('stats', new StatsWiget());
```
#### Writing a widget
```php
class UserWidget extends AbstractWidget implements Widget
{
public string $title = 'Users';
public string $component = 'UserWidget';
public function data(Request $request): Collection
{
return User::take(5)->get();
}
}
```
## Testing
```bash
composer test
```
## Changelog
Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.
## Contributing
Please see [CONTRIBUTING](https://github.com/spatie/.github/blob/main/CONTRIBUTING.md) for details.
## Security Vulnerabilities
Please review [our security policy](../../security/policy) on how to report security vulnerabilities.
## Credits
- [ryun](https://github.com/humweb)
- [All Contributors](../../contributors)
## License
The MIT License (MIT). Please see [License File](LICENSE.md) for more information.