Download the PHP package mantas-done/subtitles without Composer

On this page you can find all versions of the php package mantas-done/subtitles. 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?
mantas-done/subtitles
Rate from 1 - 5
Rated 2.00 based on 1 reviews

Informations about the package subtitles

Caption And Subtitle Converter for PHP

>> live demo <<

🥳🎉👏 Probably the best subtitle parser 🥳🎉👏

💣 Tested on thousands of user submitted files 🤯
🔥 Almost 100% unit test coverage 💥

Supported formats

Format Extension Internal format name
SubRip .srt srt
WebVTT .vtt vtt
Scenarist .scc scc
EBU STL (only reader) .stl ebu_stl
Spruce Technologies SubTitles .stl stl
Youtube Subtitles .sbv sbv
SubViewer .sub sub_subviewer
MicroDVD .sub sub_microdvd
Advanced Sub Station .ass ass
Netflix Timed Text .dfxp dfxp
TTML .ttml ttml
SAMI .smi smi
QuickTime .qt.txt txt_quicktime
Rich text format (only reader) .rtf rtf
DOCX (only reader) .docx docx
LyRiCs .lrc lrc
Comma separated values .csv csv
Plaintext .txt txt

Command line

Can be used from the command line to convert from .srt to .vtt

subtitles.phar file can be found here - https://github.com/mantas-done/subtitles/releases

Installation (supports PHP 7.4...8.4)

Usage

Convert .srt file to .vtt:

Manually create file

Load subtitles from existing file

Load subtitles from string

Save subtitles to file

Get file content without saving to file

Add subtitles `

Remove subtitles

Trim subtitles

Add 1 second to all subtitles

Subtract 0.5 second

Add 5 second to subtitles starting from 1 minute till 2 mintes

Example: shift time gradually by 2 seconds over 1 hour video. At the beginning of the video don't change time, in the middle shift time by 1 second. By the end of video, shift time by 2 seconds.

Exceptions

Library will throw UserException, it's message can be shown to the user.

By default, library tries to detect different file errors that can be shown to the user, so he would be able to fix them. If you want to relax the rules and allow the library to convert even somewhat invalid files, use ['strict' => false]

How to add new subtitle format?

You need to implement ConverterContract.php interface. It has two methods.

Basically what your implementation should be able to do, is convert subtitle file to "internal library's format", and from internal library's format back to subtitle file.

"Internal library's" format is used like middle ground, to be able to convert between different formats.

Best example is to look how SrtConverter.php is implemented.
And this is example of .srt file.

Registering your converter

You can add a new converter or replace the existing one if the format name is the same (the second parameter).

"Internal Format"

"Internal Format" is just a PHP array. It is used internally in library to be able to convert between different formats.

Running Tests

Contribution

You can contribute in any way you want. If you need some guidance, choose something from this table:

Task Difficulty Description
Add new formats Medium Supporting more formats is nice. Some popular formats: .mcc, .cap
Refactor StlConverter.php file Easy .stl format is very similar to .srt. The only problem is that StlConverter.php code can be simplified a lot (check SrtConverter.php as example)
Add .scc format Hard Format description

For now library should support only basic features (several lines of text). No need to support different text styles or positioning of text.

Report Bugs

If some file is not working with the library, please create and issue and attach the file.


All versions of subtitles with dependencies

PHP Build Version
Package Version
Requires php Version >=7.4
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 mantas-done/subtitles contains the following files

Loading the files please wait ....