Download the PHP package nicolaswurtz/chordpro-php without Composer
On this page you can find all versions of the php package nicolaswurtz/chordpro-php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download nicolaswurtz/chordpro-php
More information about nicolaswurtz/chordpro-php
Files in nicolaswurtz/chordpro-php
Package chordpro-php
Short Description Parse, transpose and format (html,json,plaintext) ChordPro format for songs lyrics with chords.
License LGPL-3.0-or-later
Informations about the package chordpro-php
chordpro-php
A simple tool to parse, transpose & format ChordPro songs with lyrics & chords.
It currently supports the following output formats :
- HTML (verses contain blocks with embricated
span
for alignement of chords with lyrics) - JSON (verses are array of arrays of chords and lyrics for alignement purpose)
- Plain text (chords are aligned with monospace text thanks to whitespaces)
And provides some extra functionnalities :
- Tranpose chords (can be very clever if original key is known)
- Display french chords
- Guess tonality key of a song
I'm french, so there's probably a lot of mistakes, my english is not always accurate — je fais ce que je peux hein :P
Install
Via composer :
Usage
See web/example.php
for demo with CSS styling.
Formatting options
Simply give an array with values at true or false for each key/option.
Specific methods
Song
$song->getKey([])
to obtain key of song, with transposition, you can alter langage english by default, or French , options array is mandatory, you could use en empty array if none$song->getOriginalKey()
to obtain key of song, as defined in metadata's field "key"
Guess key of a song
This fonctionnality is experimental and not reliable (20% of mistakes, tested with ~1000 songs), but can be very useful. Usage is very simple (you have to parse a song before as described before):
CSS Classes you can use with HTML Formatter
Verses
Verses are one line composed by blocks of text + chords, chord with class chordpro-chord
and text with class chordpro-text
.
A typical div
will be like this :
Chorus
The chorus (soc
/start_of_chorus
) will be contained inside .
Metadata
By default, all metadatas are placed inside . For example, the title will be
ChordproPHP doesn't care about the metadata names, it just puts it after chordpro-
:)
Metatada's names are always converted to their long form (
c
will be recorded ascomment
) when using short names from official directives