{"id":14462056,"url":"https://github.com/joetannenbaum/php-mac-automator","last_synced_at":"2025-05-13T01:35:06.837Z","repository":{"id":154162615,"uuid":"632005770","full_name":"joetannenbaum/php-mac-automator","owner":"joetannenbaum","description":"A PHP library to do script automation on your Mac ","archived":false,"fork":false,"pushed_at":"2023-05-01T00:39:35.000Z","size":8137,"stargazers_count":20,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-03-27T04:12:55.905Z","etag":null,"topics":["automation","mac","php"],"latest_commit_sha":null,"homepage":"https://joe.codes","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/joetannenbaum.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-04-24T14:10:46.000Z","updated_at":"2025-02-06T15:25:16.000Z","dependencies_parsed_at":null,"dependency_job_id":"fbd032dd-5c36-4559-91da-2f57e8620e67","html_url":"https://github.com/joetannenbaum/php-mac-automator","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joetannenbaum%2Fphp-mac-automator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joetannenbaum%2Fphp-mac-automator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joetannenbaum%2Fphp-mac-automator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joetannenbaum%2Fphp-mac-automator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/joetannenbaum","download_url":"https://codeload.github.com/joetannenbaum/php-mac-automator/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246591782,"owners_count":20801984,"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":["automation","mac","php"],"created_at":"2024-09-01T22:01:45.105Z","updated_at":"2025-04-01T12:31:18.602Z","avatar_url":"https://github.com/joetannenbaum.png","language":"PHP","funding_links":[],"categories":["PHP"],"sub_categories":[],"readme":"# PHP Mac Automator\n\nA simple wrapper around JXA scripts to allow you to control your Mac using PHP.\n\n**👋 This is a work in progress.** I'm still finalizing the API and adding features, things may change.\n\nThat being said, it's pretty fun to play with. So please do so.\n\n## Installation\n\n```bash\ncomposer require joetannenbaum/php-mac-automator\n```\n\n## Usage\n\n```php\nuse Automator\\Automator;\n\n$automator = new Automator();\n\n// Open Warp terminal and list the files in the current directory\n$automator-\u003eopen('Warp')-\u003etypeAndEnter('ls')-\u003erun();\n\n// or\nAutomator::make()-\u003eopen('Warp')-\u003etypeAndEnter('ls')-\u003erun();\n```\n\n## Opening Apps\n\n```php\n$automator-\u003eopen('Warp');\n```\n\n## Typing\n\n```php\n$automator-\u003etype('Hello World');\n$automator-\u003etypeAndEnter('Hello World');\n\n// With modifier keys (e.g. zoom in)\n$automator-\u003ewithCommand('+');\n$automator-\u003ewithShift('+');\n$automator-\u003ewithOption('+');\n$automator-\u003ewithControl('+');\n\n// With multiple modifier keys (e.g. re-open last tab)\n$automator-\u003etype('t', [Modifier::COMMAND, Modifier::SHIFT]);\n\n// Helpers\n$automator-\u003eenter();\n$automator-\u003etab();\n$automator-\u003ebackspace();\n$automator-\u003edelete();\n$automator-\u003eescape();\n$automator-\u003espace();\n$automator-\u003earrowUp();\n$automator-\u003earrowDown();\n$automator-\u003earrowLeft();\n$automator-\u003earrowRight();\n$automator-\u003ehome();\n$automator-\u003eend();\n$automator-\u003epageUp();\n$automator-\u003epageDown();\n\n// Add modifer(s) to helper\n$automator-\u003eenter(Modifier::SHIFT);\n$automator-\u003eenter([Modifier::COMMAND, Modifier::SHIFT]);\n\n// Set the typing speed\n// 0.1 seconds between each character (default is 0.05)\n$automator-\u003esetTypingSpeed(0.1);\n```\n\n## Utilities\n\n```php\n// Open an app\n$automator-\u003eopen('Warp');\n\n// Pause (seconds)\n$automator-\u003epause(1);\n\n// Repeat a block of code (e.g. zoom in five times)\n$automator-\u003erepeat(\n    5,\n    fn (Automator $remote) =\u003e $remote-\u003etypeWithCommand('+')-\u003epause(.05),\n);\n```\n\n## Gotchas\n\n-   This script is actually sending keystrokes to your applications, but it's running at computer speed. Remember to insert reasonable `pause` statements in your scripts to allow your computer to catch up.\n-   If you are running a script, it will keep executing until the process itself is stopped or the script finishes. Meaning: If you tab away from the app the script is running in, if the script has more typing to do, it will continue typing. Keep that in mind.\n\n## Examples\n\n### Demo a Raycast Extension\n\n```php\nAutomator::make()\n    -\u003etypeWithCommand(' ')\n    -\u003epause(1)\n    -\u003etype('Warp Launch')\n    -\u003epause(.5)\n    -\u003eenter()\n    -\u003epause(.5)\n    -\u003etype('blog-joe-codes')\n    -\u003epause(.5)\n    -\u003eenter()\n    -\u003erun();\n```\n\n![Code Snippet Demo](images/raycast-demo.gif)\n\n### Demo a Code Snippet\n\n```php\nAutomator::make()\n    -\u003esetTypingSpeed(.1)\n    -\u003eopen('Visual Studio Code')\n    -\u003epause(1)\n    -\u003etype('n', [Modifier::SHIFT, Modifier::COMMAND]) // Open a new window\n    -\u003epause(.5)\n    -\u003etypeWithCommand('n') // Open a new file\n    -\u003epause(.5)\n    -\u003etype('\u003c?php')\n    -\u003epause(.5)\n    -\u003erepeat(2, fn (Automator $remote) =\u003e $remote-\u003eenter()-\u003epause(.25))\n    -\u003etype('echo \"Hello World!\";')\n    -\u003erun();\n```\n\n![Code Snippet Demo](images/vscode-demo.gif)\n\n## Roadmap\n\nRight now you can basically automate anything you can do with your keyboard. I would like to add:\n\n-   [ ] Mouse control\n-   [ ] Window control\n-   [ ] File system control\n-   [ ] Browser control\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoetannenbaum%2Fphp-mac-automator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjoetannenbaum%2Fphp-mac-automator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoetannenbaum%2Fphp-mac-automator/lists"}