{"id":17689056,"url":"https://github.com/godbout/alfred-workflow-workflow","last_synced_at":"2025-05-13T00:48:46.928Z","repository":{"id":37589047,"uuid":"272218480","full_name":"godbout/alfred-workflow-workflow","owner":"godbout","description":"Takes care of all the Alfred glue for you so that you need to code only what is specific to your Workflow.","archived":false,"fork":false,"pushed_at":"2022-06-29T16:16:29.000Z","size":107,"stargazers_count":7,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-13T00:48:38.690Z","etag":null,"topics":["alfred","alfred-workflow","php","template","workflow"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/godbout.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":"godbout","ko_fi":"godbout"}},"created_at":"2020-06-14T14:28:17.000Z","updated_at":"2022-05-06T16:25:13.000Z","dependencies_parsed_at":"2022-08-25T15:51:39.745Z","dependency_job_id":null,"html_url":"https://github.com/godbout/alfred-workflow-workflow","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/godbout%2Falfred-workflow-workflow","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/godbout%2Falfred-workflow-workflow/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/godbout%2Falfred-workflow-workflow/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/godbout%2Falfred-workflow-workflow/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/godbout","download_url":"https://codeload.github.com/godbout/alfred-workflow-workflow/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253850882,"owners_count":21973672,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["alfred","alfred-workflow","php","template","workflow"],"created_at":"2024-10-24T11:46:23.211Z","updated_at":"2025-05-13T00:48:46.862Z","avatar_url":"https://github.com/godbout.png","language":"PHP","funding_links":["https://github.com/sponsors/godbout","https://ko-fi.com/godbout"],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003ePHP Alfred Workflow Workflow\u003c/h1\u003e\n\n\u003cp align=\"center\"\u003e\n    \u003ca href=\"https://packagist.org/packages/godbout/alfred-workflow-workflow\"\u003e\u003cimg src=\"https://poser.pugx.org/godbout/alfred-workflow-workflow/v/stable\" alt=\"Latest Stable Version\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://github.com/godbout/alfred-workflow-workflow/actions\"\u003e\u003cimg src=\"https://img.shields.io/github/workflow/status/godbout/alfred-workflow-workflow/tests\" alt=\"Build Status\"\u003e\u003c/a\u003e \n    \u003ca href=\"https://scrutinizer-ci.com/g/godbout/alfred-workflow-workflow\"\u003e\u003cimg src=\"https://img.shields.io/scrutinizer/g/godbout/alfred-workflow-workflow.svg\" alt=\"Quality Score\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://scrutinizer-ci.com/g/godbout/alfred-workflow-workflow\"\u003e\u003cimg src=\"https://scrutinizer-ci.com/g/godbout/alfred-workflow-workflow/badges/coverage.png?b=master\" alt=\"Code Coverage\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://packagist.org/packages/godbout/alfred-workflow-workflow\"\u003e\u003cimg src=\"https://poser.pugx.org/godbout/alfred-workflow-workflow/downloads\" alt=\"Total Downloads\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n    Tired of writing the same code over and over just to get your new Workflow up and running? Yeah me too.\n\u003c/p\u003e\n\n___\n\n## DOUBLE WHAMMY WORKFLOW\n\nAn [Alfred](https://alfredapp.com/) [Workflow](https://www.alfredapp.com/workflows/) does only two things: \n\n    1. show results  \n    2. do an action  \n    2.5. ok send a notification, maybe\n\nwhich means, why typing over and over those same stuff over and over. I say stop to wasting keyboard keys. (Even more if you work on a MacBook because the keyboard will break soon.)\n\n## BUT WTF IS THAT, REALLY\n\nBasically it's a set of base classes and some conventions and an Alfred Workflow Skeleton to get you up in no time. Follow the conventions and all you have to do is create your Menus, and your Actions. All the boring rest is handled by the Skeleton, and this package. The common glue is taken care of. You focus only on the specificity of your Workflow.\n\n## Installation\n\n```bash\ncomposer require godbout/alfred-workflow-workflow\n```\n\n## The Conventions\n\nWell this is where it gets interesting, because i'm still not sure how to express it. Best currently is to go through different use cases together. See the three cases below.\n\n### Case 1: Alfred Ploi\n\nThis is the most straightforward Workflow. It doesn't override anything so it follows all the conventions, and only defines what it specifically needs.\n\n1. Your Workflow Class only needs to define the possible actions of the Workflow: https://github.com/godbout/alfred-ploi/blob/0.1.0/src/Workflow.php\n2. Your `Entrance` Menu Class defines what should be shown to the Alfred user when they start the Workflow: https://github.com/godbout/alfred-ploi/blob/0.1.0/src/Menus/Entrance.php. `Entrance` is a convention for the first Menu of your Workflow (although you can name it whatever you want, but then you need to override the `currentMenu` method. See [Alfred Time](#case-3-alfred-time) below). All other Menus can be called whatever you want, as they will be defined as `args` of your Menu Items.\n3. The script called by Alfred only checks whether you're showing a Menu or calling an Action: https://github.com/godbout/alfred-ploi/blob/0.1.0/src/app.php\n\nThat's it. Just pass the right [`args` and `variables`](#args-and-variables) according to the conventions and it just works.\n\nCheck the Alfred Ploi Workflow for the Workflow Skeleton: https://github.com/godbout/alfred-ploi/releases/tag/0.1.0 \n\n### Case 2: Alfred Kat\n\nThis Workflow overrides only the `do` and `notify` methods.\n\n1. The `do` method needs a specific argument, so it is overriden: https://github.com/godbout/alfred-kat/tree/4.1.0/src/Workflow.php#L10\n2. The `notify` method needs to send different notifications, so it is overriden too: https://github.com/godbout/alfred-kat/tree/4.1.0/src/Workflow.php#L21\n3. The Menus (only one in this case) are not overriden: https://github.com/godbout/alfred-kat/tree/4.1.0/src/Menus/Entrance.php\n\nAll the rest of the wiring is handled by this package, and the Alfred Workflow Skeleton: https://github.com/godbout/alfred-kat/releases/tag/4.1.0\n\n### Case 3: Alfred Time\n\nThis is the hardest one. It overrides:\n\n1. The `do` method, passing an argument, sometimes: https://github.com/godbout/alfred-time/blob/3.0.0/src/Workflow.php#L37\n2. The `notify` method, for custom messages: https://github.com/godbout/alfred-time/blob/3.0.0/src/Workflow.php#L52\n3. The way Menus are loaded, because in this Workflow, Menus are arranged in specific (Timer Services) folders: https://github.com/godbout/alfred-time/blob/3.0.0/src/Workflow.php#L30\n\nAnd yet, even in this case, most of the code is just specific code for this particular Workflow. Most of the Alfred wiring is handled by this package, and the Workflow Skeleton: https://github.com/godbout/alfred-time/releases/tag/3.0.0\n\n### Args and Variables\n\nSo, a Workflow does two things: \n1. show a Menu \n2. do an Action\n\nHow do you tell Alfred which Menu to show or which Action to run? Through the `args` and `variables`.\n\nFor example, in your `Entrance` Menu Class, you show a menu:\n\n```php\nclass Entrance extends BaseMenu\n{\n    public static function scriptFilter()\n    {\n        ScriptFilter::add(\n            Item::create()\n                -\u003etitle('Choose your Project')\n                -\u003earg('choose_project')\n        );\n\n        // ...\n    }\n```\n\nAlfred will then call your `src/Menus/ChooseProject.class` Class and its `scriptFilter` method, where you design what appears in your next Menu.\n\nAny `arg` that is different than `do` is taken as a Menu, loaded from the `src/Menus` folder (with the default convention, as see with [Alfred-Time](#case-3-alfred-time), you can override how/where the Menus are loaded).\n\nTo do an Action:\n\n```php\nclass SelectFile extends BaseMenu\n{\n    public static function scriptFilter()\n    {\n        ScriptFilter::add(\n            Item::create()\n                -\u003etitle('Delete File')\n                -\u003earg('do')\n                -\u003evariable('action', 'deleteFile'),\n            Item::create()\n                -\u003etitle('Copy File')\n                -\u003earg('do')\n                -\u003evariable('action', 'copyFile');\n        );\n\n        // ...\n    }\n}\n```\n\nFor the first item, Alfred will call your `Workflow` Class and its `deleteFile` method. For the second item, the `copyFile` method.\n\nFor a simple example, see the [Alfred Ploi Workflow source](https://github.com/godbout/alfred-ploi/tree/master/src) again.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgodbout%2Falfred-workflow-workflow","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgodbout%2Falfred-workflow-workflow","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgodbout%2Falfred-workflow-workflow/lists"}