Download the PHP package godbout/alfred-workflow-php without Composer
On this page you can find all versions of the php package godbout/alfred-workflow-php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download godbout/alfred-workflow-php
More information about godbout/alfred-workflow-php
Files in godbout/alfred-workflow-php
Package alfred-workflow-php
Short Description Generate Alfred 3 or 4 Workflow Results in PHP with a laugh.
License MIT
Homepage https://github.com/godbout/alfred-workflow-scriptfilter
Informations about the package alfred-workflow-php
PHP Alfred Workflow ScriptFilter
Why
Starting with Alfred 3.4.1 you can define variables for individual items and variables and icon for each various modifiers (ctrl, cmd, shift, fn, alt) of each item. That makes rendering the results for Alfred a little tougher than usual with the current tools available, hence this package.
If you don't need the new fields introduced by Alfred 3.4.1 and 3.5, you might want to use Joe Tannenbaum's package. His API might be a little less heavier than mine.
Installation
Usage
The main ScriptFilter
class is a singleton. You can create many
instances of all the other classes: Item
, Variable
, Icon
, and the Mod
classes: Ctrl
, Fnn
, Shift
, Alt
, and Cmd
.
You may check the structure and options of the Alfred Script Filter JSON Format here: https://www.alfredapp.com/help/workflows/inputs/script-filter/json/
will result in:
You can add items, variables, rerun automatically your script:
will result in:
You can sort your results ascendingly, descendingly, by title or anything else:
You can filter your results (you might want to do this with the input from the user) based on any field from your items:
Helpers
There's a couple of helpers that should make your code a bit more enjoyable to write. (Or not.)
ScriptFilter
The ScriptFilter can be written using a fluent interface:
Item
Icon
Variable
Full API
You might want to check the tests to see the full API: tests
The API should mostly help you avoid typing too much and putting wrong data where Alfred is expecting something strict.
Alternatives
- alfred-workflow by Joe Tannenbaum