Download the PHP package hartman/vtt-vivid without Composer

On this page you can find all versions of the php package hartman/vtt-vivid. 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 vtt-vivid

The goal of this project is to implement a parser, validator and writer for WebVTT in the PHP language.

The specification for WebVTT is documented at:

The project features:

  1. A parser.
    • The parser is a stream-based parser. It consumes characters but processes the WebVTT file line by line.
    • The parser can run in strict or in quirks mode
    • The parser fires callbacks that produce the content, error and warning events.
  2. A VTT subtitle content parser.
  3. File readers and writers

I intend to eventually add a full processor that can render:

Examples

Validating a WebVTT File

You can use the VttReader class to validate a WebVTT file. To enable strict validation, you can configure the VttReader to operate in strict mode. Below is an example:

Generating a Simple Subtitle File

You can use the VttWriter class to generate a WebVTT file. Below is an example:

Working with cue text

A cue's payload is plain WebVTT cue text, but the library can also expose it as a tree of typed nodes following the WebVTT cue text parsing rules. VttCue::getContentNodes() parses the text (once, cached) into:

You can also author a cue from a node tree with setContentNodes(), which keeps getText() and the serialized forms in sync. Both toCueText() and casting the cue (or any node) to a string return the canonical cue text — timestamps and escapes normalized, unrecognized tags dropped:

Validating cue text directly

CueTextParser can be used on its own; pass a ValidationReporter to collect warnings without stopping the parse. It reports unauthorized tags, unclosed / mismatched / unexpected end tags, v/lang tags missing their annotation, and class names that look like unrecognized colours (e.g. suggesting lime for green). Nesting is capped at 100 levels so that pathological input cannot exhaust the stack.

Commands

The bin directory contains additional command-line tools build enabled by this project:

  1. vtt-validator: Validates WebVTT files for syntax and structural correctness.

    • Options:
      • --strict: Enables strict validation mode.
      • --subtitles: Validates the text of each cue for proper formatting and reports warnings for invalid content.
  2. vtt-to-json: Converts WebVTT files to a JSON representation.

Development

This project builds on the legacy of the pre-standardization vtt.js parser as originally released by Mozilla. https://github.com/mozilla/vtt.js

Some of its test cases were imported and converted. Some of the approach is also based on this original implementation.

Requirements

Installing Dependencies

To install the required dependencies, run the following command:

This will download and set up all the necessary libraries and packages for the project.

Linting and Fixing

To ensure code quality and adherence to coding standards, the project includes linting and automatic fixing tools. Use the following commands:

Test Cases

The project includes a comprehensive set of test cases to ensure the correctness of the WebVTT parser, validator, and writer. The test cases are organized into the following categories:

  1. Unit Tests: These tests validate individual components of the project, such as the parser, processor, and validation logic.
  2. Integration Tests: These tests ensure that the various components work together as expected.
  3. Bin Tests: These tests verify the functionality of the command-line tools provided in the bin directory.

The test cases are located in the tests directory and are further organized into subdirectories based on their category.

Running Tests

To run the test suite, use the following command:

This command will execute all the test cases and provide a summary of the results. Ensure that you have Composer installed and the required dependencies set up before running the tests. You can also run specific categories of tests:

Running Tests for a Single File

To run tests from a specific file, use the following command:

Replace tests/path/to/YourTestFile.php with the relative path to the test file you want to execute.

License

This project is dual-licensed under the Apache License, Version 2.0 and the MIT License. See the LICENSE file for details.

Authors

Derk-Jan Hartman [email protected]


All versions of vtt-vivid with dependencies

PHP Build Version
Package Version
Requires php Version >=8.2.0
ext-dom Version *
ext-json Version *
ext-libxml Version *
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 hartman/vtt-vivid contains the following files

Loading the files please wait ...