Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/steveedson/bitbar-php
PHP formatter for BitBar plugins
https://github.com/steveedson/bitbar-php
bitbar bitbar-php bitbar-plugin bitbar-plugins php-formatter
Last synced: 8 days ago
JSON representation
PHP formatter for BitBar plugins
- Host: GitHub
- URL: https://github.com/steveedson/bitbar-php
- Owner: SteveEdson
- License: mit
- Created: 2016-01-22T15:05:22.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2019-01-04T10:16:58.000Z (almost 6 years ago)
- Last Synced: 2024-10-20T23:13:44.196Z (15 days ago)
- Topics: bitbar, bitbar-php, bitbar-plugin, bitbar-plugins, php-formatter
- Language: PHP
- Size: 94.7 KB
- Stars: 67
- Watchers: 4
- Forks: 7
- Open Issues: 1
-
Metadata Files:
- Readme: readme.md
- License: LICENSE.md
Awesome Lists containing this project
README
# BitBar PHP Formatter
[![Latest Stable Version](https://poser.pugx.org/steveedson/bitbar-php/v/stable)](https://packagist.org/packages/steveedson/bitbar-php) [![Total Downloads](https://poser.pugx.org/steveedson/bitbar-php/downloads)](https://packagist.org/packages/steveedson/bitbar-php) [![Latest Unstable Version](https://poser.pugx.org/steveedson/bitbar-php/v/unstable)](https://packagist.org/packages/steveedson/bitbar-php) [![License](https://poser.pugx.org/steveedson/bitbar-php/license)](https://packagist.org/packages/steveedson/bitbar-php)
[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2FSteveEdson%2Fbitbar-php.svg?type=shield)](https://app.fossa.io/projects/git%2Bgithub.com%2FSteveEdson%2Fbitbar-php?ref=badge_shield)## 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:
```json
{
"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.
```php
#!/usr/bin/phpnewLine();
// Set the text and formatting
$line
->setText("Hello World")
->setColour("yellow")
->setUrl("https://steveedson.co.uk")
->show();
```### Examples
#### Using Sub Menus
```php
// Create BitBar formatter
$bb = new BitBar();// Create the first line
$line = $bb->newLine();// Set the text and formatting
$mainMenu = $line
->setText("Servers")
->setColour("yellow");$mainMenu = $mainMenu->addSubMenu()
->newLine()
->setText("Server 1")
->setUrl('http://server1.com');$mainMenu = $mainMenu->addSubMenu()
->newLine()
->setText("Server 2")
->setUrl('http://server2.com');$mainMenu->show();
```## License
[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2FSteveEdson%2Fbitbar-php.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2FSteveEdson%2Fbitbar-php?ref=badge_large)