Download the PHP package chaostangent/php-ass without Composer

On this page you can find all versions of the php package chaostangent/php-ass. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package php-ass

php-ass

A library for reading Advanced Substation Alpha subtitle files.

Specification

The ASS file specs are available in various parts in various places:

  1. Wikipedia has a good overview
  2. The original format in Microsoft Word .doc format
  3. How the files are incorporated into Matroska (MKV) files

In short: ASS files are an advanced version of the original SSA (Sub Station Alpha) subtitle files and include several improvements in terms of styling and effects.

A valid script file starts with [Script Info] and contains several sections in INI style format.

Quick start

Install using composer:

Then start using:

Parts

Script

The ChaosTangent\ASS\Script class represents the root object of an ASS script.

You instantiate a Script with the content of a script as well as an optional filename:

Once instantiated you can check whether what's been passed looks like a valid ASS script:

This only checks the first few bytes for the "[Script Info]" string, it doesn't guarantee that a passed script is valid or readable.

To parse the passed script:

This will go through the content passed when creating the script and parse it into blocks and lines.

To get the current collection of blocks, you can call getBlocks() or treat the script as an iterator:

To check if a script has a block:

Block

Every ASS script is comprised of a few different blocks. The ChaosTangent\ASS\Block\Block abstract class represents one of these blocks.

At the moment php-ass supports the following blocks:

Any other kind of block (e.g. "Aegisub Project Garbage", "Fonts") are silently ignored when parsing.

ScriptInfo blocks provide functions for common fields:

Otherwise you can just treat blocks as containers for lines. You can use array access to get a specific line:

Or treat the block as an iterator:

Line

Lines are the core of a script file. Any line that isn't a comment (not to be confused with a comment event line) uses the base class ChaosTangent\ASS\Line\Line.

Lines in some blocks are mapped according to a special "Format" line. These are represented by ChaosTangent\ASS\Line\Format. Format lines have a special getMapping() method that returns an array that can be used to parse other lines.

If all of this sounds a bit complicated, you mostly won't have to worry about it if parsing files as it's all taken care of for you. All it means is that for Dialogue and Style lines, you can use methods to get the different parts:

Dialogue lines also have an extra method for getting the text of a line without any style override codes in it:

For all lines you can use the generic getKey() and getValue() methods which will return the key of the line (e.g. "Dialogue", "Format", "Style") and its unparsed value:

If you only want lines of a specific type, just do an instanceof check when iterating through:

Tests

There is a growing test suite for this library that you can use phpunit to validate against. Any esoteric or known broken scripts would be a welcome addition.

TODO


All versions of php-ass with dependencies

PHP Build Version
Package Version
Requires php Version >=5.3.3
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package chaostangent/php-ass contains the following files

Loading the files please wait ....