Download the PHP package shishima/dynamic-view-value-render without Composer
On this page you can find all versions of the php package shishima/dynamic-view-value-render. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download shishima/dynamic-view-value-render
More information about shishima/dynamic-view-value-render
Files in shishima/dynamic-view-value-render
Package dynamic-view-value-render
Short Description This package support handle rendering data in file excel
License MIT
Homepage https://github.com/shishima/dynamic-export-config
Informations about the package dynamic-view-value-render
Dynamic View Value Render
This package supports displaying values in views files according to predefined configurations. You don't need to directly modify the blade file, just adjust the config, and this package will handle the conversion for you
Installation
You can install the package via composer:
Usage
-
Create a configuration file in the
config
directoryE.g: Create a configuration file for home blade
-
In the controllers or similar, before returning the view, use the
dynamic_render_set_data
function to assign the input dataE.g: app/Controllers/HomeController.php
You can use the compact function to collect data into an array and then pass it to the
dynamic_render_set_data
function - In the blade file, at the positions where values need to show, use the
dynamic_render_value
function to output values based on the initial configuration
Config
In the config file, there are two configurable values: type
and value
Type
The configured parameters will be an array. Within the array will be classes for transforming output data
There are 2 classes available:
-
\Shishima\ConvertExport\Pipeline\DB::class
This class is used to retrieve data from within a variable. Nested data at multiple levels can be accessed through the dot
.
notationUse the value config to specify the key to retrieve the value
E.g:
-
\Shishima\ConvertExport\Pipeline\Fixed::class
This class is used to print out predefined values configured in the
value
E.g:
Custom Transform
In practical cases, data conversion may involve special cases. In such scenarios, to handle these cases, we can create a dedicated processing class and pass this class into type for the package to handle automatically
Since type
is an array, multiple processing classes can be passed here. The data will be processed in the order from left to right
The output data of this class will be the input data for the next class
E.g: Create UpperCase class
IMPORTANT! If this class only performs a only task, you must use the __invoke
method
Custom class must extend the ConvertExportBase
class
The parameter $payload
is an array consisting of 3 values:
- value: Input data of previous processing steps
- dataInput: All the data assigned when using the function
dynamic_render_set_data
- config: The configuration passed through the function
dynamic_render_value
After creating the custom class, configure this class in the config file
Custom Class contains multiple processing methods
The package also supports writing multiple processing functions within one class
To do this, methods must start with the prefix convert
E.g:
To use these functions in the config file, they will be configured under the type. No need for the convert
prefix
Value
Used for DB::class
and Fixed::class
to retrieve data
If not using the above 2 classes, it can be left blank
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
- Phuoc Nguyen
- All Contributors
License
The MIT License (MIT). Please see License File for more information