PHP formatter for BitBar plugins
PHP
Latest commit db55895 Jun 21, 2016 @Coriou Coriou committed with Fix for wrong parameter "templateImage" + allow for changing both fon…
…t face and font size independently (#8)

* Fix for wrong parameter "templateImage"

The param « imageTemplate » should actually be « templateImage ».

I haven’t replaced the variables names because that’s not important,
even though they are backwards too.

* You can change the font and font size independently

We were not able to change the font size OR the font face, it had to be
both which is incorrect

readme.md

BitBar PHP Formatter

Latest Stable Version Total Downloads Latest Unstable Version License

Installing

Currently, BitBar reads any file in your directory a plugin, and tries to execute it. To workaround this, create a hidden folder, beginning with a dot, for example .bitbar/. In this directory create or edit your composer.json to include the library:

{
  "require": {
    "steveedson/bitbar-php": "dev-master"
  }
}

or run $ composer require "steveedson/bitbar-php"

File Structure

You file structure inside your plugins directory, should look something like:

.
├── .bitbar/
│   ├── composer.json
│   └── vendor/
└── test.5m.php

Usage

In your BitBar plugins directory, create a file, e.g. test.5m.php. Don't forget to add the shebang at the beginning.

#!/usr/bin/php

<?php

require ".bitbar/vendor/autoload.php";

use SteveEdson\BitBar;

// Create BitBar formatter
$bb = new BitBar();

// Create the first line
$line = $bb->newLine();

// Set the text and formatting
$line
    ->setText("Hello World")
    ->setColour("yellow")
    ->setUrl("https://steveedson.co.uk")
    ->show();