PHP code example of haythem / dynamic-field

1. Go to this page and download the library: Download haythem/dynamic-field library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

haythem / dynamic-field example snippets


    Route::get('/dynamicfield', function () {
        return [
        "value" => rand(0, 100) . "%",
        "show" => true, "stop" => false,
        "showAnimation" => true,
        "showValue" => true];
    });

   DynamicField::make("Dynamic Field")
       ->endPoint('/dynamicfield')
        ->callEvery(500) // time in ms
        ->badgesMap([ "5"=>"primary","1"=>"success", "2"=>"danger", "3"=>"warning", "4"=>"info","6"=>"#71504e"]) // if you need to make it a badge
        ->markAsDone(true, "Im done"),