├── .github └── FUNDING.yml ├── .gitignore ├── LICENSE ├── README.md ├── google.png ├── icon.png ├── info.plist ├── pest.php └── screenshot.png /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | github: [tillkruss, alexmartinfr] 2 | custom: ["https://www.paypal.me/tillkruss", "https://www.paypal.me/alexmartin"] 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /vendor 2 | .DS_Store 3 | composer.lock 4 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2016 Till Krüss 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Pest PHP Docs Workflow for Alfred 2 | 3 | An ultra-fast Pest PHP docs search workflow for [Alfred](https://www.alfredapp.com). 4 | 5 | ![Screenshot](screenshot.png) 6 | 7 | ## Installation 8 | 9 | 1. [Download the latest version](https://github.com/AlexMartinFR/alfred-pestphp-docs/releases/download/v0.1.0/pestphp-docs.alfredworkflow) 10 | 2. Install the workflow by double-clicking the `.alfredworkflow` file 11 | 3. You can add the workflow to a category, then click "Import" to finish importing. You'll now see the workflow listed in the left sidebar of your Workflows preferences pane. 12 | 13 | ## Usage 14 | 15 | Just type `pest` followed by your search query: 16 | 17 | ``` 18 | pest 19 | pest test 20 | ``` 21 | 22 | Either press `⌘Y` to Quick Look the result, or press `` to open it in your web browser. 23 | 24 | ## Credits 25 | 26 | This workflow is based on Till Kruss' [Laravel Docs workflow](https://github.com/tillkruss/alfred-laravel-docs). -------------------------------------------------------------------------------- /google.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexmartinfr/alfred-pestphp-docs/3f4004665340c2023f661c60ed5794aafe2f78ad/google.png -------------------------------------------------------------------------------- /icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexmartinfr/alfred-pestphp-docs/3f4004665340c2023f661c60ed5794aafe2f78ad/icon.png -------------------------------------------------------------------------------- /info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | bundleid 6 | com.alexmartinfr.alfred-pestphp-doc 7 | category 8 | Productivity 9 | connections 10 | 11 | 5F3B3AF3-9709-4EE5-8742-31952977E46C 12 | 13 | 14 | destinationuid 15 | 3A309868-3B85-42B4-AA2F-26EB0FB9F4BE 16 | modifiers 17 | 0 18 | modifiersubtext 19 | 20 | vitoclose 21 | 22 | 23 | 24 | 25 | createdby 26 | Alex Martin 27 | description 28 | An ultra-fast Pest PHP docs search workflow 29 | disabled 30 | 31 | name 32 | Pest PHP Docs 33 | objects 34 | 35 | 36 | config 37 | 38 | browser 39 | 40 | spaces 41 | 42 | url 43 | {query} 44 | utf8 45 | 46 | 47 | type 48 | alfred.workflow.action.openurl 49 | uid 50 | 3A309868-3B85-42B4-AA2F-26EB0FB9F4BE 51 | version 52 | 1 53 | 54 | 55 | config 56 | 57 | alfredfiltersresults 58 | 59 | alfredfiltersresultsmatchmode 60 | 0 61 | argumenttreatemptyqueryasnil 62 | 63 | argumenttrimmode 64 | 0 65 | argumenttype 66 | 0 67 | escaping 68 | 4 69 | keyword 70 | pest 71 | queuedelaycustom 72 | 3 73 | queuedelayimmediatelyinitially 74 | 75 | queuedelaymode 76 | 0 77 | queuemode 78 | 1 79 | runningsubtext 80 | Searching docs for "{query}"... 81 | script 82 | php pest.php "{query}" 83 | scriptargtype 84 | 0 85 | scriptfile 86 | 87 | subtext 88 | Search the Pest PHP docs... 89 | title 90 | Pest Docs 91 | type 92 | 0 93 | withspace 94 | 95 | 96 | type 97 | alfred.workflow.input.scriptfilter 98 | uid 99 | 5F3B3AF3-9709-4EE5-8742-31952977E46C 100 | version 101 | 3 102 | 103 | 104 | readme 105 | # Pest PHP Docs Workflow for Alfred 106 | 107 | An ultra-fast Pest PHP docs search workflow for Alfred. 108 | 109 | ## Installation 110 | 111 | 1. Download the latest version: https://github.com/AlexMartinFR/alfred-pestphp-docs/releases/download/v0.1.0/pestphp-docs.alfredworkflow 112 | 113 | 2. Install the workflow by double-clicking the `.alfredworkflow` file 114 | 115 | 3. Click "Import" to finish importing. You'll now see the workflow listed in the left sidebar of your Workflows preferences pane. 116 | 117 | ## Usage 118 | 119 | Just type `pest` followed by your search query: 120 | 121 | ``` 122 | pest <query> 123 | pest test 124 | ``` 125 | 126 | Either press `⌘Y` to Quick Look the result, or press `<enter>` to open it in your web browser. 127 | 128 | ## Credits 129 | 130 | This workflow is based on Till Kruss' Laravel Docs workflow: 131 | https://github.com/tillkruss/alfred-laravel-docs 132 | uidata 133 | 134 | 3A309868-3B85-42B4-AA2F-26EB0FB9F4BE 135 | 136 | xpos 137 | 545 138 | ypos 139 | 145 140 | 141 | 5F3B3AF3-9709-4EE5-8742-31952977E46C 142 | 143 | xpos 144 | 235 145 | ypos 146 | 145 147 | 148 | 149 | variablesdontexport 150 | 151 | version 152 | 0.1.0 153 | webaddress 154 | https://github.com/AlexMartinFR/alfred-pestphp-docs 155 | 156 | 157 | -------------------------------------------------------------------------------- /pest.php: -------------------------------------------------------------------------------- 1 | initIndex('pestphp'); 18 | $search = $index->search($query); 19 | $results = $search['hits']; 20 | 21 | $subtextSupported = $subtext === '0' || $subtext === '2'; 22 | 23 | if (empty($results)) { 24 | $google = sprintf('https://www.google.com/search?q=%s', rawurlencode("pestphp {$query}")); 25 | 26 | $workflow->result() 27 | ->title($subtextSupported ? 'Search Google' : 'No match found. Search Google...') 28 | ->icon('google.png') 29 | ->subtitle(sprintf('No match found. Search Google for: "%s"', $query)) 30 | ->arg($google) 31 | ->quicklookurl($google) 32 | ->valid(true); 33 | 34 | $workflow->result() 35 | ->title($subtextSupported ? 'Open Docs' : 'No match found. Open docs...') 36 | ->icon('icon.png') 37 | ->subtitle('No match found. Open https://pestphp.com/docs/installation/...') 38 | ->arg('https://pestphp.com/docs/installation/') 39 | ->quicklookurl('https://pestphp.com/docs/installation/') 40 | ->valid(true); 41 | 42 | echo $workflow->output(); 43 | exit; 44 | } 45 | 46 | $urls = []; 47 | 48 | foreach ($results as $hit) { 49 | 50 | $highestLvl = $hit['hierarchy']['lvl6'] ? 6 : ($hit['hierarchy']['lvl5'] ? 5 : ($hit['hierarchy']['lvl4'] ? 4 : ($hit['hierarchy']['lvl3'] ? 3 : ($hit['hierarchy']['lvl2'] ? 2 : ($hit['hierarchy']['lvl1'] ? 1 : 0))))); 51 | 52 | $title = $hit['hierarchy']['lvl' . $highestLvl]; 53 | $currentLvl = 0; 54 | $subtitle = $hit['hierarchy']['lvl0']; 55 | while ($currentLvl < $highestLvl) { 56 | $currentLvl = $currentLvl + 1; 57 | $subtitle = $subtitle . ' » ' . $hit['hierarchy']['lvl' . $currentLvl]; 58 | } 59 | 60 | $workflow->result() 61 | ->uid($hit['objectID']) 62 | ->title($title) 63 | ->autocomplete($title) 64 | ->subtitle($subtitle) 65 | ->arg($hit['url']) 66 | ->quicklookurl($hit['url']) 67 | ->valid(true); 68 | } 69 | 70 | echo $workflow->output(); 71 | -------------------------------------------------------------------------------- /screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexmartinfr/alfred-pestphp-docs/3f4004665340c2023f661c60ed5794aafe2f78ad/screenshot.png --------------------------------------------------------------------------------