php-mtg/php-mana-bridge

A library that brings the mana js library to the php world

7.0.7 2024-12-08 16:39 UTC

README

A library that brings the mana js library to the php world.

coverage build status

Installation

The installation of this library is made via composer and the autoloading of all classes of this library is made through their autoloader.

You must add the asset-packagist repository to your composer.json :

	"repositories" : [{
			"type" : "composer",
			"url" : "https://asset-packagist.org",
			"name" : "asset-packagist"
		}
	]

The repository is mandatory as the npm packages do not appear in the generic packagist repository. Then :

  • Download composer.phar from their website.
  • Run the following command to install this library as dependency :
  • php composer.phar php-mtg/php-mana-bridge ^7

Basic Usage


use PhpMtg\Mana\Mana;

$symb = Mana::findByCode('w'); // returns a white mana symbol
(string) $symb->getIconHtml(); // <i class="ms ms-w"></i>

For the icon to appear on an html page, you have to publish the css and font files (or uses a cdn like jsdeliver, as specified in the original readme of the mana-font library).

The methods Mana::getCssFilePath() and Mana::getFontFilePaths() are made for this task, as they point to the existing files in the mana-font library, under your vendor directory (as created by composer).

License

Proprietary