Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/morilog/widgetify
Powerful Widgets System For Laravel Farmework
https://github.com/morilog/widgetify
cache laravel laravel-5-package modular widget
Last synced: 2 months ago
JSON representation
Powerful Widgets System For Laravel Farmework
- Host: GitHub
- URL: https://github.com/morilog/widgetify
- Owner: morilog
- License: mit
- Created: 2016-11-08T09:24:39.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2018-01-22T07:32:21.000Z (almost 7 years ago)
- Last Synced: 2024-03-15T00:04:33.603Z (10 months ago)
- Topics: cache, laravel, laravel-5-package, modular, widget
- Language: PHP
- Homepage: https://github.com/morilog/widgetify
- Size: 6.84 KB
- Stars: 12
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Widgetify
Laravel widget package for Laravel >= 5.1## Installation
```
composer require morilog/widgetify
```
#### Register in Laravel
- Add `Morilog\Widgetify\WidgetifyServiceProvider` to `config/app.php` providers array- If you need to Facade for rendering widgets, add bellow in `config/app.php` aliases array :
```php
'Widgetify' => Morilog\Widgetify\Facades\Widgetify::class
```- For publish Widgetify config file, run this command:
```
php artisan vendor:publish --provider="Morilog\Widgetify\WidgetifyServiceProvider"
```---
## Usage
#### Create new widget
For creating new widget you must create a class that extended `Morilog\Widgetify\Widget` and implement `handle()` method.
```php
get();return view('path.to.view.file', compact('latestPosts'));
}
}```
#### Registering Widget
- Add your widget to `widgets` array in `config/widgetify.php` file:```php
'widgets' => [
'simple_widget' => App\MyWidgets\SimpleWidget::class
]
```#### Rendering Widgets
With blade `@widgetify` directive:
```php
// views/sidebar.blade.php
@widgetify('simple_widget')
```OR with configs:
```php
// views/sidebar.blade.php
@widgetify('simple_widget', ['key' => 'value', 'key2' => 'value'])
```OR with `Widgetify` Facade:
```php
// views/sidebar.blade.php
{!! Widgetify::render('simple_widgets') !!}
```#### Using cache
```php
// views/default.blade.php
{!! Widgetify::remember('my_widget', 15, [CONFIGS]); !!}
@cached_widgetify('my_widget', 15, [CONFIGS]);```