humweb/thingamabob

This is my package thingamabob

0.3 2023-07-03 08:43 UTC

README

run-tests PHPStan Check & fix styling

Installation

You can install the package via composer:

composer require humweb/thingamabob

You can publish and run the migrations with:

php artisan vendor:publish --tag="thingamabob-migrations"
php artisan migrate

You can publish the config file with:

php artisan vendor:publish --tag="thingamabob-config"

This is the contents of the published config file:

return [
    'route' => '/api/widgets',
    'middleware' => [],
    'assets_path' => resource_path('js/widgets/'),
];

Usage

Register new widget

Widgets::resgister('stats', new StatsWiget());

Writing a widget

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

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

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