PHPackages                             skyzyx/alfred-workflow-builder - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. skyzyx/alfred-workflow-builder

AbandonedArchivedLibrary[Utility &amp; Helpers](/categories/utility)

skyzyx/alfred-workflow-builder
==============================

Workflow Builder for Alfred 2

1.0.5(12y ago)16428MITPHPPHP &gt;=5.3.3CI passing

Since Mar 31Pushed 12y ago1 watchersCompare

[ Source](https://github.com/skyzyx/alfred-workflow-builder)[ Packagist](https://packagist.org/packages/skyzyx/alfred-workflow-builder)[ Docs](https://github.com/skyzyx/alfred-workflow-builder)[ RSS](/packages/skyzyx-alfred-workflow-builder/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependencies (3)Versions (7)Used By (0)

Alfred Workflow Builder
=======================

[](#alfred-workflow-builder)

Alfred Workflow Builder is a PHP class for creating workflows with Alfred 2. This class provides functions for working with plist settings files, reading and writing data to files, generating Alfred feedback results, and more.

Installation
------------

[](#installation)

[Composer](http://getcomposer.org) is the recommended way to install is package. Composer is dependency management tool for PHP that allows you to declare the dependencies your project needs and installs them into your project.

1. Add `skyzyx/alfred-workflow-builder` as a dependency in your project's `composer.json` file.

    ```
    {
        "require": {
            "skyzyx/alfred-workflow-builder": "1.0.*"
        }
    }
    ```
2. Download and install Composer.

    ```
    curl -s "http://getcomposer.org/installer" | php
    ```
3. Install your dependencies.

    ```
    php composer.phar install --optimize-autoloader
    ```
4. Require Composer's autoloader. Composer also prepares an autoload file that's capable of autoloading all of the classes in any of the libraries that it downloads. To use it, just add the following line to your code's bootstrap process.

    ```
    require 'vendor/autoload.php';
    ```

The [original version of this class](https://github.com/jdfwarrior/Workflows) (written by [David Ferguson](http://dferg.us)) had methods for things like caching data to local files and fetching remote data over HTTP. Instead, we recommend you use [Guzzle](http://guzzlephp.org), [Requests](http://requests.ryanmccue.info) or [Buzz](https://github.com/kriswallsmith/Buzz)for HTTP requests and [Doctrine Cache](http://docs.doctrine-project.org/en/2.0.x/reference/caching.html) for local file system caching. If you'd also like logging, we recommend [Monolog](https://github.com/Seldaek/monolog).

---

`Alfred\Workflow`
-----------------

[](#alfredworkflow)

```
use Alfred\Workflow;

// Pass a Bundle ID
$w = new Workflow('com.ryanparman.my-workflow');
#=>
```

### `string` toXML()

[](#string-toxml)

Accepts a properly formatted array or json object and converts it to XML for creating Alfred feedback results. If results have been created using the `result()` function, then passing no arguments will use the array of results created using the `result()` function.

#### Example using result function

[](#example-using-result-function)

```
$w->result(array(
    'uid'          => 'itemuid',
    'arg'          => 'itemarg',
    'title'        => 'Some Item Title',
    'subtitle'     => 'Some item subtitle',
    'icon'         => 'icon.png',
    'valid'        => 'yes',
    'autocomplete' => 'autocomplete'
));
echo $w->toXML();
```

#### Example using array

[](#example-using-array)

```
$results = array();
$temp = array(
    'uid'          => 'itemuid',
    'arg'          => 'itemarg',
    'title'        => 'Some Item Title',
    'subtitle'     => 'Some item subtitle',
    'icon'         => 'icon.png',
    'valid'        => 'yes',
    'autocomplete' => 'autocomplete'
);
array_push($results, $temp);
echo $w->toXML($results);
```

#### Result

[](#result)

```

        Some Item Title
        Some item subtitle
        icon.png

```

### `array` mdfind()

[](#array-mdfind)

Executes an `mdfind` command and returns results as an array of matching files.

```
$results = $w->mdfind('"kMDItemContentType == com.apple.mail.emlx"');
/* or */
$results = $w->mdfind('Alfred 2.app');
#=> (array) ['/Applications/Alfred 2.app']
```

You can learn more about querying the OS X metadata service by checking out:

- [Using Spotlight from the OS X Commandline](http://0xfe.blogspot.com/2006/03/using-spotlight-from-os-x-commandline.html)
- [File Metadata Query Expression Syntax](https://developer.apple.com/library/mac/#documentation/carbon/conceptual/spotlightquery/concepts/queryformat.html)
- [Spotlight Metadata Attributes](https://developer.apple.com/library/mac/#documentation/carbon/Reference/MetadataAttributesRef/Reference/CommonAttrs.html#//apple_ref/doc/uid/TP40001694-SW1)

### `array` result()

[](#array-result)

Creates a new result item that is cached within the class object. This set of results is available via the `results()`functions, or, can be formatted and returned as XML via the `toXML()` function.

   Key Usage     `uid` Unique ID for the search result. (Required)

   `arg` Argument for this result. This will get fed into any downstream actions. (Required)

   `title` The main title for the result. (Required)

   `subtitle` The subtitle for the result. (Required)

   `icon` The icon that this result should have. This should typically be `icon.png`. (Required)

   `valid` If you press enter with this result selected, should it trigger downstream actions? Valid values are `"yes"`, `"no"`, `true` and `false`. The default value is `"yes"`.

   `autocomplete` If you press enter with this result selected, what value should pop up as an autocomplete value? ([Movies](http://simonbs.dk/post/41727742869/movies-workflow-for-alfred-2-0) is a good usage example.)

  #### Example

[](#example)

```
$w->result(array (
    'uid'          => 'alfred',
    'arg'          => 'alfredapp',
    'title'        => 'Alfred',
    'subtitle'     => '/Applications/Alfred.app',
    'icon'         => 'fileicon:/Applications/Alfred.app',
    'valid'        => 'yes',
    'autocomplete' => 'Alfredapp',
));
echo $w->toXML();
```

#### Result

[](#result-1)

```

        Alfred
        /Applications/Alfred.app
        /Applications/Alfred.app

```

---

`Alfred\Storage\Plist`
----------------------

[](#alfredstorageplist)

```
use Alfred\Storage\Plist;

// Pass a Bundle ID and Plist name
$plist = new Plist('com.ryanparman.my-workflow', 'info');
#=>
```

### `string` setValue()

[](#string-setvalue)

Stores a key-value pair.

```
$plist->setValue('username', 'rparman');
```

### `string` setValues()

[](#string-setvalues)

Stores a series of key-value pairs.

```
$plist->setValues(array(
    'username' => 'rparman',
    'password' => 'abc123',
    'zipcode'  => '90210',
));
```

### `string` getValue()

[](#string-getvalue)

Retrieves the value of a key.

```
$username = $plist->getValue('username');
#=> (string) rparman
```

More!
-----

[](#more)

You can learn more about Alfred 2 Workflows by checking out .

You can also deconstruct some workflows that are built with Alfred Workflow Builder.

- [Packagist](https://github.com/skyzyx/packagist.alfredworkflow)
- [Geolocation](https://github.com/skyzyx/geolocation.alfredworkflow)
- [Mimetypes](https://github.com/skyzyx/mimetypes.alfredworkflow)

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 67.6% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~19 days

Total

6

Last Release

4695d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/39447?v=4)[Ryan Parman](/maintainers/skyzyx)[@skyzyx](https://github.com/skyzyx)

---

Top Contributors

[![skyzyx](https://avatars.githubusercontent.com/u/39447?v=4)](https://github.com/skyzyx "skyzyx (23 commits)")[![jdfwarrior](https://avatars.githubusercontent.com/u/116663?v=4)](https://github.com/jdfwarrior "jdfwarrior (11 commits)")

---

Tags

workflowalfred

### Embed Badge

![Health badge](/badges/skyzyx-alfred-workflow-builder/health.svg)

```
[![Health](https://phpackages.com/badges/skyzyx-alfred-workflow-builder/health.svg)](https://phpackages.com/packages/skyzyx-alfred-workflow-builder)
```

###  Alternatives

[symfony/maker-bundle

Symfony Maker helps you create empty commands, controllers, form classes, tests and more so you can forget about writing boilerplate code.

3.4k111.1M568](/packages/symfony-maker-bundle)[symplify/monorepo-builder

Not only Composer tools to build a Monorepo.

5205.3M82](/packages/symplify-monorepo-builder)[franzl/studio

Develop your Composer libraries with style

1.1k634.5k15](/packages/franzl-studio)[civicrm/civicrm-core

Open source constituent relationship management for non-profits, NGOs and advocacy organizations.

728272.9k20](/packages/civicrm-civicrm-core)[shlinkio/shlink

A self-hosted and PHP-based URL shortener application with CLI and REST interfaces

4.8k4.3k](/packages/shlinkio-shlink)[temporal/sdk

Temporal SDK

4002.2M18](/packages/temporal-sdk)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
