2017 © Pedro Peláez
 

library swftools

PHP SwfTools

image

swftools/swftools

PHP SwfTools

  • Wednesday, April 25, 2018
  • by romain
  • Repository
  • 9 Watchers
  • 16 Stars
  • 103,344 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 3 Forks
  • 0 Open issues
  • 10 Versions
  • 3 % Grown

The README.md

PHP Swftools

Build Status, (*1)

PHP Swftools is a tiny lib which help you to use SWFTools http://www.swftools.org/, (*2)

SWFTools are GPL licensed and are described as "a collection of utilities for working with Adobe Flash files", (*3)

Documentation available at http://php-swftools.readthedocs.org/, (*4)

Installation

It is recommended to install PHP-Swftools through Composer :, (*5)

{
    "require": {
        "swftools/swftools": "~0.1.0"
    }
}

Dependencies

In order to use PHP SwfTools, you need to install SWFTools. Depending of your configuration, please follow the instructions at http://wiki.swftools.org/wiki/Installation., (*6)

Main API usage

$file = new SwfTools\FlashFile(SwfTools\Binary\DriverContainer::create());

// Render the animation to a PNG file
$file->render('Animation.swf', 'renderedAnimation.png');

// List all embedded object found in the animation.
// Available object types are : Shapes, Fonts, PNGs, JPEGs, Frames, MovieClip
foreach($File->listEmbeddedObjects('Animation.swf') as $embeddedObject) {
    echo sprintf("found an object type %s with id %d\n", $embeddedObject->getType(), $embeddedObject->getId());
}

// Extract embedded Object #1
$file->extractEmbedded(1, 'Animation.swf', 'Object1.png');

// Extract the first embedded image found
$file->extractFirstImage('Animation.swf', 'renderedAnimation.jpg');

Setting timeout

PHPSwfTools uses underlying processes to execute commands. You can set a timeout to prevent these processes to run more than a defined duration., (*7)

To disable timeout, set it to 0 (default value)., (*8)

$file = new SwfTools\FlashFile(SwfTools\Binary\DriverContainer::create(
    'timeout' => 0,
));

Using various binaries versions

PHPSwfTools uses swfextract an swfrender provided by SWFTools. If you want to specify the path to the binary you wnat to use, you can add configuration :, (*9)

$file = new SwfTools\FlashFile(SwfTools\Binary\DriverContainer::create(
    'pdf2swf.binaries'    => '/opt/local/swftools/bin/pdf2swf',
    'swfrender.binaries'  => '/opt/local/swftools/bin/swfrender',
    'swfextract.binaries' => '/opt/local/swftools/bin/swfextract',
));

Silex Service Provider

PHP-Swtools provides a Silex service provider. Every option is optional, use them depending of your configuration. By default, PHP-Swftools will try to find the executable in the environment PATH and timeout is set to 0 (no timeout)., (*10)

$app = new Silex\Application();
$app->register(new SwfTools\SwfToolsServiceProvider(), array(
    'swftools.configuration' => array(
        'pdf2swf.binaries'    => '/opt/local/swftools/bin/pdf2swf',
        'swfrender.binaries'  => '/opt/local/swftools/bin/swfrender',
        'swfextract.binaries' => '/opt/local/swftools/bin/swfextract',
        'timeout'    => 300,
    ),
    'swftools.logger' => $app->share(function (Application $app) {
        return $app['monolog'];
    });
));

$app['swftools.flash-file']->render('file.swf', 'output.jpg');
$app['swftools.pdf-file']->toSwf('output.swf');

License

PHPSwftools are released under MIT License http://opensource.org/licenses/MIT, (*11)

See LICENSE file for more information, (*12)

The Versions

25/04 2018

dev-SILEX2

dev-SILEX2

PHP SwfTools

  Sources   Download

MIT

The Requires

 

The Development Requires

flash swf adobe flash

25/04 2018

4.1.0

4.1.0.0

PHP SwfTools

  Sources   Download

MIT

The Requires

 

The Development Requires

flash swf adobe flash

07/11 2017

dev-master

9999999-dev

PHP SwfTools

  Sources   Download

MIT

The Requires

 

The Development Requires

flash swf adobe flash

07/11 2017

0.3.2

0.3.2.0

PHP SwfTools

  Sources   Download

MIT

The Requires

 

The Development Requires

flash swf adobe flash

03/07 2013

0.3.1

0.3.1.0

PHP SwfTools

  Sources   Download

MIT

The Requires

 

The Development Requires

flash swf adobe flash

26/06 2013
23/04 2013

0.2.1

0.2.1.0

PHP SwfTools

  Sources   Download

MIT

The Requires

 

The Development Requires

flash swf adobe flash

22/04 2013

0.2.0

0.2.0.0

PHP SwfTools

  Sources   Download

MIT

The Requires

 

The Development Requires

flash swf adobe flash

11/02 2013

0.1.1

0.1.1.0

PHP SwfTools

  Sources   Download

MIT

The Requires

 

The Development Requires

flash swf adobe flash

21/12 2012