sauls / widget
Simple but powerful widget system for PHP
Requires
- php: >=7.4
- sauls/collections: ^1.0
- symfony/options-resolver: ^5.1
Requires (Dev)
- php-coveralls/php-coveralls: ^2.0
- phpunit/phpunit: ^9.0
- symfony/cache: ^5.1
- twig/twig: ^3.0
Suggests
- symfony/cache: Add this if you want to cache widgets responses
- twig/twig: Add this if yf you want to use twig as renderer
README
Simple but powerful widget system for PHP
Requirements
PHP >= 7.4 Twig ^3.0
Installation
Using composer
$ composer require sauls/widget
Apppend the composer.json file manually
{ "require": { "sauls/widget": "^1.0" } }
FAQ
What is this all about?
This library allows you to crate a standalone, reusable widgets that can be highly customizable for better user-interfaces.
What it lacks?
-
Assets - At the moment it does not have a
js
andcss
management support, but support forjs
andcss
is planned in future versions. -
Integrations - At the moment this library has only
twig
template engine integration.
What is a Widget?
Widget is a standalone, reusable and highly customizable class that can be used anywhere in the view multiple times with different configurations. There is two types of widgets:
- Widget
- ViewWidget
What is a View?
View - is a class that knows how to render widget output.
Default Views
- NullView
- StringView
- PhpFileView
- TwigView
Documentation
Keep in mind that this documentation is work in progress as it takes some time to properly write it. At the moment if you don't know where to start looking at the tests folder would be a good start.
How-to`s
- How to create a widget?
- How to create a view widget?
- How to add own dependencies to widget?
- How to create widget containing other widgets?
- How to setup and use widget factory
Integrations
- Twig
If you are using different template engine, and find this library useful feel free to create a pull request with your template engine integration!