Mac 上的 Web 开发者最喜欢的编程工具
PHP Mac
![](/data/attachment/album/202006/22/005056o9lr9yt42b3yf4gj.jpg)



> 
> 我在 Mac 上编写 WordPress 插件，这些是我的工具列表。
> 
> 
> 


根据 [2020 年 Stack Overflow 开发者调查报告](https://insights.stackoverflow.com/survey/2020#technology-platforms-professional-developers5)，在 Mac 上工作的编码者（27.5%）比在 Linux 上工作的编码者（26.6%）要多一点。相比之下，使用 Windows 作为开发机器的开发者数量几乎是其两倍（45.8%）。多年来，我在不同的平台之间跳来跳去，但我发现自己经常回到 Mac 上。


事实上，我从 Mac 专用的应用程序中获得了很多生产力，尤其是用于视频制作的 Final Cut Pro X。我喜欢能够在同一台机器上运行 Windows、Linux 和 Mac 应用程序，而这只有在 Mac 上才能实现（我将在下文中详谈）。虽然 Windows 也提供了一个强大的命令行环境，但我喜欢拥有一个完全是 Linux 风格的命令行，并且 Mac 上集成良好的图形工具对其进行了完整补充。


在本文中，我将向你展示我使用的工具。许多是跨平台的，而另一些是 Mac 专用的。虽然我过去曾开发过 Mac 应用和 iOS 应用，但我现在的开发工作完全是针对 Web 的。我维护了 10 个开源的 WordPress 插件，包括一个支持了 10000 多个非营利组织的捐款插件和一个支持了 20000 多个网站的网站隐私插件。


虽然我过去用过很多编程语言（也写过自己的编程语言），但我目前的项目主要涉及 PHP 和 JavaScript，并擅长 CSS、HTML 和 SQL（及一些框架）。为了创建和维护这些代码，我使用了下面所示的各种工具。在本篇中，我将向你展示我安装的工具。在以后的文章中，我将向你展示和深入介绍有助于完成工作的云服务。


就这样，让我们开始吧。


### 集成开发环境：PhpStorm


![](/data/attachment/album/202006/22/005211trurrife8ruu6jgu.jpg)


关于代码编辑和开发环境的话题，引发的宗教式的争论我都数不清了。有些程序员坚持走老路，只依靠命令行和 vi、emacs 等编辑器。有些程序员喜欢轻量级的文本编辑器，有些则喜欢可扩展性更强的编辑器，比如 vi 和 emacs。其他人则喜欢更加可扩展的编辑器，比如 Atom 和 Sublime Text。还有一些编码者，包括我自己，喜欢完整的集成开发环境，比如 PhpStorm、Visual Studio Code 和 Xcode（主要是它的 Mac 和 iOS 原生开发工具）。


我选择的武器一直是 [PhpStorm](https://www.jetbrains.com/phpstorm/)。我已经使用它多年了。它有一个优秀的集成调试环境，可以进行本地和远程调试。它还集成了我日常使用的各种功能，从它自带的终端窗口到文件同步，再到版本控制和逐行文件历史记录。另外，它还有丰富的插件可供选择，可以扩展和提升编码体验。


我最喜欢的一些插件包括：


* **Rainbow Brackets（彩虹括号）**：一个很棒的插件，它不仅能用行匹配括号，还能用颜色来匹配。它可以非常容易地看到哪些代码属于哪里。
* **String Manipulation（字符串操作）**：各种各样的字符串操作、大小写转换等等。
* **WordPress**：语法格式化和 WordPress 式的函数格式化，以及对 WordPress 挂钩的支持。对于任何一个 WordPress 插件的编码者来说都是必备的。


### 本地环境：Local


![](/data/attachment/album/202006/22/005213brubb7cxgbl7cg55.jpg)


在做 Web 开发时，通常最好有一个本地开发栈。[Local](https://localwp.com/) 就是这样一个栈。它提供了 Nginx 或 Apache、MySQL、带有 Xdebug 的 PHP 安装包，以及其他一些资源，最重要的是它带有一个隧道，这样基于互联网的资源就可以访问本地环境进行编码和测试，内置了 SSL 集成，以及 MailHog —— 它可以拦截电子邮件，用于基于电子邮件的应用测试。哦，而且是免费的。


### 快速编辑：Sublime Text


![](/data/attachment/album/202006/22/005215ubne3ydrvsye2v0o.jpg)


我之前就提到过 [Sublime Text](https://www.sublimetext.com/)，很多编码者都把它作为主要的开发环境。它几乎支持一系列传说中的插件和附加组件。当我想在 PhpStorm 固有的项目结构之外编辑项目文件时，我使用 Sublime Text 作为一个快速编辑器。它的速度快，反应灵敏，而且相当有特点。


### 提交文件到仓库：SmartSVN


![](/data/attachment/album/202006/22/005216otgmxp87c7hv3fcc.jpg)


WordPress 插件库（所有通过的插件都在这里提供给 WordPress 用户）不使用 Git 或 Github，而是使用 SVN 源码控制系统。我觉得 SVN 的命令行很烦人，所以我使用一个叫做 [SmartSVN](https://www.smartsvn.com/) 的图形化用户界面来将我的文件发送到仓库中。它大大降低了我在发布新版本时出错的几率。


### 潇洒的命令行：iTerm2


![](/data/attachment/album/202006/22/005217it4tbt4nvntp4t3p.jpg)


虽然在我的开发工具箱中，我更喜欢使用 GUI 界面来实现大部分功能，但我并不害怕在适当的时候使用命令行。虽然只使用标准的 MacOS 终端也是可以的，但我更喜欢 [iTerm2](https://www.iterm2.com/)。它提供了分屏、命令补全、粘贴历史等功能。它还可以根据你的心情和项目进行配置。


### 节省点击的每一秒：Shortcut Bar


![](/data/attachment/album/202006/22/005218qqf9xxzqy7hedovc.jpg)


这款 Mac App Store 的小宝贝是一款方便的工具，可以捕捉快速项目，并从 Mac 的菜单栏访问它们。我最大的用途是为我正在开发的各种网站创建管理页面和用户页面的[快捷方式](https://fiplab.com/apps/shortcut-bar-for-mac)。与其切换到浏览器窗口，然后调用书签，我只需进入菜单，选择我要去的地方，就会打开浏览器。


这似乎是一个小功能，但当每天在 IDE 和浏览器之间切换数千次时，这些节省下来的鼠标动作确实不少。因为快捷栏允许分组，所以我还将本地和远程服务器测试位置的链接进行了分组。


### Mac 上的 Windows 和 Linux：Parallels Desktop


![](/data/attachment/album/202006/22/005218k37lmxkwmwb2yle7.jpg)


因为我是做 Web 开发的，我必须在基于 Windows 的浏览器上检查我的代码，这意味着我需要启动 Windows 10 来测试新的 Edge、Chrome、Firefox 和 —— 请原谅我，还有 IE11。是的，还有用 IE11 的用户。


我在本文的介绍中提到了 [Parallels Desktop](https://www.anrdoezrs.net/links/9041660/type/dlg/sid/zd-14bdfb9dd2c448eda3bc07eae0b3691c---/https://www.parallels.com/products/desktop/)。我发现在同一台机器上运行 Windows、Mac 和 Linux 的能力在某些情况下是非常有用的。也就是说，我一直在[楼上办公室的 Mac](https://www.zdnet.com/article/5-reasons-im-not-sorry-i-bought-my-mac-mini-and-didnt-wait-for-the-new-mac-pro/) 上运行 Windows，它是我的速度和容量最大的一台机器。那台机器也是我用于视频制作的机器。


我的主要开发机器其实是在楼下，就在沙发旁边。这要追溯到我的狗狗还小的时候，我在办公室工作的时候，它经常会觉得孤独和害怕。现在，我在工作时，它趴在我的腿上是相当愉快的，我已经建立了一个完整的工作站，可以让我坐在客厅里，与键盘和狗共享我的膝盖。


那台机器是一台 [2013 年的 i7 iMac](https://www.zdnet.com/article/maxed-out-imac-just-how-far-can-we-push-this-thing/)，内存 32GB。它是开发的理想之选，但它的速度实在不够快，无法满足多个 4K 视频流的需求。也不足以快到真正成功地托管 Windows 桌面。这让我想到了……


### 连接到远程机器：屏幕共享和微软远程桌面


![](/data/attachment/album/202006/22/005219f0niaejb3fn2qqjz.jpg)


尽管我的开发机器在楼下，而我的视频制作机器在楼上，但无论我在哪里，我都可以在其中任何一台机器上工作。我只需使用 MacOS 内置的“屏幕共享”应用来连接到远程机器。


当我想从楼下的开发机器连接到 Windows 时，我使用“[微软远程访问](https://apps.apple.com/us/app/microsoft-remote-desktop/id1295203466?mt=12)”。这是从 Mac OS 应用商店免费下载的，它提供了一个进入我的 Windows 10 机器的完整的远程界面。请注意，如果你打算使用“微软远程访问”，你需要运行 Windows 10 Pro。Windows Home 不支持远程访问。


哦，如果你想知道为什么这套环境似乎没有一个用于移动环境中，在咖啡店编程的组件，这很简单：如今的大流行病。一旦明确我所有的编码工作都将在家里完成，我就把我的开发工作整合到一台容量不错的固定机器上，并针对机器之间的千兆以太网进行了优化。如果我们还生活在之前的“旧常态”中，我就会有一个更以云为中心的实现。我很怀念咖啡店。


### 管理 MySQL 数据的整洁界面：Sequel Pro


![](/data/attachment/album/202006/22/005220czimgaema7yzhuoz.jpg)


我的代码要做大量的 SQL 操作。因此，我需要能够查看已经存储到数据库中的内容。对我来说，最简单、最快速的方法不是 PhpMyAdmin，而是一个叫 [Sequel Pro](https://www.sequelpro.com/) 的 Mac 本地应用（很奇妙，它的图标上把煎饼和数据存储混为一体）。


我最常用的方式是打开一个数据库表，搜索 “value contains” 或 “option\_name contains”，然后查找结果。它的速度很快，并且允许我在开发过程中对数据进行操作。我应该指出，PhpStorm 也有一个数据库浏览器，但我发现 Sequel Pro 对我来说更有效率。


### 一个不太复杂的 SFTP 客户端：Forklift


![](/data/attachment/album/202006/22/005309ei22v3ubnshiv7bi.jpg)


我花了很长时间才改掉了通过命令行和 SSH 隧道使用 SFTP 的习惯。而 [Forklift](https://binarynights.com/) 是一个很好的替代品。它保留了一个网站和登录信息的列表，支持加密，并提供了一个传统的拖放界面来批量移动文件。


### 强大的应用自动化：Keyboard Maestro


![](/data/attachment/album/202006/22/005222ce44nzjloccdbjbb.jpg)


与 Final Cut Pro X 一样，[Keyboard Maestro](https://www.keyboardmaestro.com/main/) 是让我继续使用 Mac 的专用软件工具之一。我在 2011 年首次购买了 Keyboard Maestro，此后我一直使用它来制作各种专业脚本。


它是一个非常强大的跨应用脚本工具，也非常容易使用。我经常写一些特殊用途的脚本来运行一个原本需要很长时间的任务。我的一些脚本是非常强大的，可以跨多个应用程序。其他的脚本，比如截图中的 Stripe 填充测试，只做一件事，一遍又一遍。


我们来谈谈这个问题。在为我的捐赠插件开发 Stripe 支付网关时，我必须发起测试支付，大概有上千次。在我编码、测试和调试的过程中，我不得不用相同的测试数据填写相同的信用卡字段，一遍又一遍。Keyboard Maestro 中的一个简单的脚本为我完成了所有这些工作。我不需要为每一次测试手工填写数据，而是让 Keyboard Maestro 帮我完成。


### 特定用途的快速搜索：Alfred


![](/data/attachment/album/202006/22/005222eyvjak24ghybg89k.jpg)


[Alfred](https://www.alfredapp.com/) 是我的生产力家族的新成员。它会弹出一个命令栏，有点像 Spotlight，但增加了功能。你可以创建工作流来完成相对复杂的任务，但到目前为止，我的主要用处是四个自定义搜索。当我按下 `Alt-Space` 时，就会弹出 Alfred 的输入栏。


如果我键入 “codex”，它就会把后面的任何内容作为搜索字符串来在 WordPress 开发者文档站 codex 上搜索。输入 “plugin”，会搜索 WordPress 插件库。输入 “zdme”，会搜索 ZDNet 中我写过的带有要搜索的字符串的文章。我经常使用这个方法在文章中放置链接。现在，这些可能看起来很简单，你可以设置 Chrome 浏览器来进行自定义搜索，但同样，与快捷栏一样，这可以节省鼠标移动和按键。如果我需要查看 WordPress 函数的定义，只需轻点一下按键，就能得到它，而不需要动用鼠标。


### 你觉得怎么样？


那么，你看到了，这些是我的主要开发工具，可以帮助我完成工作。那你呢？你是编程人员吗？如果是的话，什么软件工具能帮助你提高工作效率？请在下面的评论中告诉我们。




---


via: https://www.zdnet.com/article/one-developers-favorite-mac-coding-tools-for-php-and-web-development/


作者：[David Gewirtz](https://www.zdnet.com/meet-the-team/us/david-gewirtz/) 译者：[wxy](https://github.com/wxy) 校对：[wxy](https://github.com/wxy)


本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译，[Linux中国](/article-12326-1.html) 荣誉推出



OK
'ZDNET Recommends': What exactly does it mean?

ZDNET's recommendations are based on many hours of testing, research, and comparison shopping. We gather data from the best available sources, including vendor and retailer listings as well as other relevant and independent reviews sites. And we pore over customer reviews to find out what matters to real people who already own and use the products and services we’re assessing.

When you click through from our site to a retailer and buy a product or service, we may earn affiliate commissions. This helps support our work, but does not affect what we cover or how, and it does not affect the price you pay. Neither ZDNET nor the author are compensated for these independent reviews. Indeed, we follow strict guidelines that ensure our editorial content is never influenced by advertisers.

ZDNET's editorial team writes on behalf of you, our reader. Our goal is to deliver the most accurate information and the most knowledgeable advice possible in order to help you make smarter buying decisions on tech gear and a wide array of products and services. Our editors thoroughly review and fact-check every article to ensure that our content meets the highest standards. If we have made an error or published misleading information, we will correct or clarify the article. If you see inaccuracies in our content, please report the mistake via [this form](https://zdnet.zendesk.com/hc/en-us/requests/new).

[Close]

# One developer's favorite Mac coding tools for PHP and web development

![david-gewirtz](https://www.zdnet.com/a/img/resize/82f5fad827e74b33983e1b52c5eab1af7464d827/2022/08/05/de4475ef-be59-4858-beb8-6f7696c85945/david-gewirtz.jpg?auto=webp&fit=crop&frame=1&height=192&width=192)

According to the [2020 Stack Overflow Developer Survey](https://insights.stackoverflow.com/survey/2020#technology-platforms-professional-developers5), more coders work on Macs (27.5%) than on Linux (26.6%), but only by a very small margin. By contrast, nearly twice as many developers (45.8%) use Windows as their development machines. Over the years, I've jumped between platforms, but I find myself regularly returning to the Mac.

**Also: **[Best web hosting services](https://www.zdnet.com/article/best-web-hosting-service-provider/)

The fact is, I gain a lot of productivity from Mac-specific apps, particularly Final Cut Pro X for video production. I like being able to run Windows, Linux, and Mac applications on the same machine, which is only possible on a Mac (I'll talk more about that below). While Windows offers a robust command-line environment, I like having a full Linux-style command line as well as a complete complement of the Mac's well-integrated graphical tools.

In this article, I'm going to show you the tools I use. Many are cross-platform, while others are Mac-specific. While I [have coded Mac apps and iOS apps in the past](https://www.zdnet.com/article/true-confessions-of-a-former-iphone-developer/), my coding now is entirely for the web. I maintain 10 open-source WordPress plugins, including a donations plugin that supports more than 10,000 nonprofits and a site privacy plugin that supports more than 20,000 sites.

While I have programmed in many languages in the past (and written my own), my current projects involve coding primarily in PHP and JavaScript, with CSS, HTML, and SQL (as well as some frameworks) rounding out the mix. To create and maintain the code, I use the wide range of tools shown below. In this piece, I'm going to show you the installed tools. In a future piece, I'll dive back in and show you the cloud-based services that help get the job done.

And with that, let's get started.

The subject of code editing and developing environments has sparked more religious debates than I care to count. Some programmers swear by going old school, relying solely on the command line and editors like vi and emacs. Some coders prefer light-duty text editors. Others prefer more extendable editors like Atom and Sublime Text. And still other coders, myself included, prefer full-blown integrated development environments like PhpStorm, Visual Studio Code, and Xcode (mainly for its Mac and iOS native development tools).

My weapon of choice has been PhpStorm. I've been using it for years. It has an excellent integrated debugging environment that allows for both local and remote debugging. It also has a wide range of other integrated features I use daily, ranging from its own terminal window to file synchronization to version control and line-by-line file history. Plus, it has a rich selection of plugins that expand and enhance the coding experience.

Some of my favorite plugins include:

**Rainbow Brackets:**A wonderful plugin that matches brackets not only with lines but colors. It makes it very easy to see what code belongs to what other code.**String Manipulation:**All sorts of string tweaks, case conversions, and more.**WordPress:**Syntax and WordPress-aware function formatting, along with support for WordPress hooks. A must for any WordPress plugin coder.

When coding for the web, it's often best to have a local development stack. Local is one such stack. It provides Nginx or Apache, MySQL, a PHP install with Xdebug, and a number of other resources, most notably a tunnel so internet-based resources can access the local environment for coding and testing, a built-in SSL integration, and MailHog, which intercepts email for email-based application testing. Oh, and it's free.

I mentioned Sublime Text previously, and many coders use it as their primary development environment. It supports an almost legendary array of plugins and add-ons. I use Sublime as a quick editor when I want to edit project files outside of PhpStorm's intrinsic project structure. It's fast, responsive, and oh-so-geeky.

Rather than use Git or Github, the WordPress plugin repository (where all sanctioned plugins are made available to WordPress users) uses the SVN source code control system. I find command-line SVN annoying, so I use a graphical UI called SmartSVN to send my files into the repository. It substantially reduces the chances I'll make an error when posting a new build.

While I prefer using GUI interfaces for most functions in my development kit, I'm not one to fear dropping into the command line when it suits me. While it's possible to get by with just the standard MacOS terminal, I prefer iTerm2. It provides split screens, command completion, paste history, and quite a bit more. It's also configurable to fit both your mood and your project.

This little Mac App Store gem is a handy tool for capturing quick items and accessing them from the Mac's menubar. My biggest use is creating shortcuts to the admin and user pages of the various sites I'm working on. Rather than switching to a browser window and then invoking a bookmark, I just go to the menu, choose where I want to go, and the browser opens up.

This might seem like a minor feature, but when switching between IDE and browser thousands of times a day, those saved mouse movements really do add up. Because Shortcut Bar allows grouping, I also have links grouped for local and remote server testing locations.

Because I'm doing web development, I have to check my code on Windows-based browsers, which means I need to launch Windows 10 to test the new Edge, Chrome, Firefox, and -- forgive me, Father, for I have sinned -- IE11. Yeah, there are still IE11 users out there.

I mentioned [Parallels Desktop](https://www.zdnet.com/product/parallels-desktop-15-for-mac/) in my intro to this article. I find the ability to run Windows, Mac, and Linux on the same machine to be hugely helpful in certain circumstances. That said, I've been running Windows on [my upstairs office Mac](https://www.zdnet.com/article/5-reasons-im-not-sorry-i-bought-my-mac-mini-and-didnt-wait-for-the-new-mac-pro/), which is the one with the most speed and capacity. That machine is also the machine I use for video production.

My primary development machine is actually downstairs, next to the couch. This goes back to the days of when my dog was a pup, and he used to go through withdrawal when I worked in the office. Now, it's quite pleasant to work with him on my lap, and I've set up a full workstation that allows me to sit in the living room and share my lap with both the keyboard and the dog.

That machine is a [2013 i7 iMac with 32GB of RAM](https://www.zdnet.com/article/maxed-out-imac-just-how-far-can-we-push-this-thing/). It's ideal for development, but it's just not fast enough for multiple streams of 4K video. It's also no longer fast enough to really successfully host a Windows Desktop. Which brings me to...

Even though my dev machine is downstairs and my video production machine is upstairs, I can work on either, no matter where I happen to be. I simply use the built-in Screen Sharing app from MacOS to connect to the remote machine.

When I want to connect into Windows from the downstairs dev machine, I use Microsoft Remote Access. This is a free download from the Mac OS App store, and provides a full remote interface into my Windows 10 machine. Be aware that if you plan to use Microsoft Remote Access, you need to be running Windows 10 Pro. Windows Home does not support remote access.

Oh, and in case you're wondering why this setup doesn't seem to have a mobile, programming-in-a-coffee-shop component, it's simple: the pandemic. Once it became clear that all my coding work would be done at home, I consolidated my development onto a fixed machine with good capacity and optimized for gigabit Ethernet between the machines. If we were still living in the "old normal," I'd have a much more cloud-centric implementation. I miss coffee shops.

My code does a lot of SQL work. As such, I need to be able to look at what's been stored into the database. The easiest and fastest way for me to do that is not PhpMySQL, but a Mac-native app called Sequel Pro (which, wonderfully, conflates pancakes and data storage on its icon).

My most common use is to open a database table and search for "value contains" or "option_name contains" and look for the results. It's fast and allows me to manipulate the data as part of my development process. I should point out that PhpStorm also has a database browser, but I find Sequel Pro to be more efficient for my use.

It took me a long time to break my habit of using SFTP via the command line and SSH tunnels. But Forklift is a good substitute. It keeps a list of sites and logins, handles encryption, and provides a traditional drag-and-drop interface for moving batches of files.

Along with Final Cut Pro X, Keyboard Maestro is one of the Mac-only software tools that keeps me on a Mac. I first bought Keyboard Maestro in 2011, and I've been using it for a wide range of specialty scripts ever since.

It is an incredibly powerful cross-app scripting tool that's also very easy to use. I regularly spin up special-purpose scripts to run a task that would otherwise take a long time. Some of my scripts are very powerful and cross multiple applications. Others, like the Stripe Fill Test in the screenshot, does one thing, over and over.

Let's talk about that one. When developing the Stripe payment gateway for my donations plugin, I had to initiate a test payment, probably a thousand times. As I coded and tested and debugged, I had to fill in the same credit card fields with the same test data, over and over and over. A simple script in Keyboard Maestro did all that for me. Instead of hand-filling the data for every single pass, I just let Keyboard Maestro do it for me.

Alfred is the newest addition to my productivity family. It pops up a command bar sort of like Spotlight, but with added capabilities. You can create workflows to do relatively complex tasks, but my big use so far has been four custom searches. When I hit Alt-Space, Alfred's bar pops up.

If I type "codex," it will take whatever follows and use that as a search string to the WordPress developer codex. Typing "plugin," searches the WordPress plugin repository. Typing "zdme," searches* ZDNet* for articles I've written with the search string. I use this constantly for placing links into articles. Now, these may seem simple, and you can set up Chrome to do custom searches, but again, as with Shortcut Bar, this saves mouse moves and keystrokes. If I need to see the definition for a WordPress function, a tap gets it for me, without ever needing to go to the mouse.

### What about you?

So there you have it. Those are my main developer tools that help me get the job done. What about you? Are you coding? If so, what are the software tools that help you be the most productive? Let us know in the comments below.

*You can follow my day-to-day project updates on social media. Be sure to follow me on Twitter at @DavidGewirtz, on Facebook at Facebook.com/DavidGewirtz, on Instagram at Instagram.com/DavidGewirtz, and on YouTube at YouTube.com/DavidGewirtzTV.*

[Editorial standards](/editorial-guidelines/)