PHP code example of guidepilot / php-lottie

1. Go to this page and download the library: Download guidepilot/php-lottie 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/ */

    

guidepilot / php-lottie example snippets



use GuidePilot\PhpLottie\LottieAnimation;

$lottieAnimation = new LottieAnimation(file_get_contents('animation.json'));

echo "Size: {$lottieAnimation->getWidth()}x{$lottieAnimation->getHeight()}".PHP_EOL;
echo "FrameRate: {$lottieAnimation->getFrameRate()}".PHP_EOL;
echo "Duration: {$lottieAnimation->getDuration()} seconds".PHP_EOL;


use GuidePilot\PhpLottie\DotLottieFile;

$file = new DotLottieFile('animation.lottie');

foreach ($file->getAnimations() as $aAnimation) {
    echo "Animation Id: {$aAnimation->getId()}".PHP_EOL;
    echo "Size: {$aAnimation->getWidth()}x{$aAnimation->getHeight()}".PHP_EOL;
    echo "FrameRate: {$aAnimation->getFrameRate()}".PHP_EOL;
    echo "Duration: {$aAnimation->getDuration()} seconds".PHP_EOL;
}

$ composer