Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

James Cowie:
All hail Xdebug and lets let var dump die
Jan 12, 2017 @ 12:58:23

In a recent post to his site James Cowie sings the praises of Xdebug for debugging and says that "var_dump must die" as a method for debugging in your application development flow.

How many times have you been working in Magento or any other php application and hit an error, exception or something not quite right? For me a lot. I’ve been that developer that debugs by fire and throws echo var_dumps and dies around like a western gunslinger. It’s easy, provides quick feedback cycles but lets be honest its lazy, in efficient, rarely provides all of the data you need to solve the problem on the first try and its not something you want to boast about by the coffee machine.

[...] So whats the “better” way of debugging a application? Well welcome Xdebug + PHPStorm. Imagine inside of the IDE we can set a breakpoint, a fancy die and reload our web page. Magically the IDE has stopped execution and we can see the state of the application at that exact path. We can see the variables and we can step through the code and see exactly what class and method is called next and so on and so forth.

While his instructions are specific to PHPStorm, most major IDEs will have a similar setup process with their own tweaks. In his case, though, he has one more layer of complexity - the PHP is executing inside a Docker container. He walks you through the process he followed to get the flow from container to local IDE set up. He wraps up the post with an example of debugging a script and what the results look like inside of PHPStorm (including a screencast).

tagged: xdebug vardump phpstorm docker container tutorial

Link: http://jamescowie.me/blog/2016/12/all-hail-xdebug-and-lets-let-var-dump-die/

Theo Tzaferis:
Let CodeSniffer inspect your code in PhpStorm
Sep 15, 2016 @ 10:56:32

In a quick new post to his site Theo Tzaferis shows you how to set up PHPStorm and PHP_CodeSniffer to perform automatic inspection of your PHP code's syntax.

Some time ago I wrote an article on how to format your code automatically in PhpStorm to be conform the PSR standards. In this article I want to show you how you can enable inspections in PhpStorm which throws a warning if you have code which is not PSR, e.g.
  • Whitespace at the end of line
  • No newline at the end of file
  • No newline between namespace and use statements
  • etc…
This is pretty easy. We will use squizlabs/PHP_CodeSniffer from Github.

I’m doing this on an Ubuntu machine, but it should work the same in OS X (no idea about Windows).

He then provides the (*nix-centric) instructions on getting the two tools up and playing happily together. Fortunately PHPStorm comes with handy built-in support for PHP_CodeSniffer, basically only requiring you to install phpcs and point it to the right location. The rest is handled by the IDE when you enable the automatic evaluation.

tagged: phpstorm codesniffer tutorial setup configure automatic inspection

Link: http://tzfrs.de/2016/09/let-codesniffer-inspect-your-code-in-phpstorm/

Adam Culp:
Using an SSH tunnel to step debug through a firewall
Apr 19, 2016 @ 10:54:28

Adam Culp has followed up some of his previous posts about the setup and configuration of remote debugging in PHP applications (more specifically in Zend Studio) with this new post. In it he shows how to use a SSH tunnel to allow debugging to happen through a firewall for those cases when direct access isn't possible.

In a previous post I covered how to set up step debugging in Zend Studio. But if that doesn’t work there may be a firewall in between the server and the debugging client, or IDE, preventing the connection. Here is a possible way to get around that.

He assumes that you already have the SSH server and connection available to you (he doesn't cover the install of that part). He then steps you through the setup of Zend Studio to add a new server, configure the SSH tunneling and remote/local ports to use. In his case he was using Zend Server so switching on debugging was as easy as turning in debugging via the toolbar. It's also worth noting that another popular PHP IDE can handle SSH-based debugging as well - PHPStorm - as seen here.

tagged: remote debugging ssh zendstudio setup configure tutorial phpstorm

Link: http://www.geekyboy.com/archives/1242

Thijs Feryn:
Interviewing Gary Hockin from JetBrains (Dev Evangelism, travel, PHPStorm & PHP cons)
Nov 06, 2015 @ 13:13:33

Thijs Feryn has posted his latest in his series of video interviews with members of the PHP community. In this latest episode he talks with Gary Hockin of JetBrains about developer evangelism, the PHPStorm IDE and community conferences.

A couple of weeks ago I was in Las Vegas for Zendcon where I had to opportunity to chat with a lot of friends from the PHP community. This week’s episode features Gary Hockin, developer evangelist at JetBrains. Gary advocates the PHPStorm project and is a proud Welshman.

Because Gary and I are both evangelists, one of the central themes of the interview is developer evangelism. We talk about the life, the travel, the public speaking, but also about the not so glamorous parts of the job. Throughout the conversation we also talk about PHPStorm and PHP community conferences.

You can watch the video either through his in-page video player or over on YouTube. If you prefer the audio-only route, you can also listen on SoundCloud. You can also check out previous interviews Thijs has done in this category on his site.

tagged: community travel evangelism phpstorm ide jetbrains garyhockin thijsferyn video interview conference zendcon

Link: http://blog.feryn.eu/2015/11/06/interviewing-gary-hockin-from-jetbrains-talking-about-developer-evangelism-travel-phpstorm-php-community-conferences/

JetBrains Blog:
Docker Support in PhpStorm
Nov 03, 2015 @ 10:08:35

In this recent post to the JetBrains blog they show how to set up and configure the Docker support the latest version includes built in to the IDE.

Docker is an open platform for building, shipping and running distributed applications. It gives programmers, development teams and operations engineers the common toolbox they need to take advantage of the distributed and networked nature of modern applications.

With the new Docker integration plugin for PhpStorm, you can add Docker support to existing projects, view logs, manage Docker containers, and debug PHP web applications from right inside PhpStorm.

They help you get the integration plugin installed and show you where the machine should be located and how to set it up under PHPStorm's deployment options. Next up they include the steps for getting the Docker machine up and running (again, inside the IDE) and managing the containers related to the machine.

tagged: docker support phpstorm ide jetbrains container machine

Link: http://blog.jetbrains.com/phpstorm/2015/10/docker-support-in-phpstorm/

Knp University:
Our favorite PhpStorm Live Templates: Share yours
Aug 21, 2015 @ 10:49:39

The Knp University site has a posted an article where they've shared their favorite PHPStorm Live templates, a set of handy shortcuts that can make for less typing on your part and, as a result, less development time spent on common keystrokes.

Most editors have a feature like this, and if you’re not leveraging them, you’re slowing yourself down. Seriously: taking a few minutes to get into these now could add up to a lot of hours saved in the future. The vim users at KnpLabs love this kind of stuff, and have published their own snippets (docteurklein, PedroTroller, Einenlum).

In our tutorial about live templates, we turn formhandle into a snippet that types about 10 lines of form-handling boilerplate code from 10 characters of text. So I started wondering: what are some other awesome live templates we should all be using?

To this end, they've created a repository to store some of these helpful shortcuts. Their list so far includes shortcuts for a 404 if statement, several Twig tags, several for use in a controller context and YAML formatting. The repository includes instructions on how to install the shortcuts and how to include only the ones you want.

tagged: phpstorm live template share repository starter snippet shortcut

Link: http://knpuniversity.com/blog/phpstorm-live-templates

Community News:
Dutch PHP Conference Video - 42 Tips & Tricks for PHPStorm
Jul 01, 2015 @ 08:40:25

The Laravel News site has linked to a presentation from Mikhail Vink at the recent Dutch PHP Conference in Amsterdam. The video they've linked to was a presentation he gave showing 42 Tips & Tricks for PHPStorm, a popular PHP IDE.

With the PhpStorm IDE buzzing in modern PHP community, there are always many neat things to learn for better synergy with your every-day tool for web development. This session will give you an insight on 42 powerful tips and tricks that will make you more productive and efficient. From lightning-smart navigation to debugging and testing hidden tricks, from making UI of the IDE even more suitable for presentations to some handy tools integrations - all of those tips will find a good use in your development workflow.

You can watch the video of the full presentation over on YouTube. The video is a full-on screencast so you get to see every move he makes including special keystrokes, general IDE functionality, settings changes and built in tools like a REST client and integration with other external tools.

tagged: dpc15 conference video mikhailvink phpstorm tips tricks

Link: https://youtu.be/J9emzl_VmIs

Matt Stauffer:
Sublime Text (3) for PHP Developers
Jun 29, 2015 @ 09:25:55

Matt Stauffer has posted a set of helpful hints for developers using Sublime Text (3) to help make them more efficient and writing code much easier.

A lot of folks in the PHP community have been checking out PHPStorm lately, including myself and most of the developers I work with. We love the code intelligence we get from PHPStorm, but still miss the speed, quick boot-up, and convenience of Sublime Text. Before I blindly assume PHPStorm is the only way to go, I wanted to see: Can I bring the things a PHP-focused IDE provides PHP developers back to Sublime Text and get the best of both worlds?

He starts with a list of "must haves" for him to be able to move from PHPStorm, features it provides that Sublime, an editor not IDE, might not come with out of the box. Most of his suggestions use the Package Control functionality in Sublime so you'll need that installed to try out his examples. He then shows several tools you can install including:

  • Sublime PHP Companion (package)
  • AllAutocomplete (package)
  • Cmd-click for function definition
  • Integrating Code sniffing and PHP_CodeSniffer
  • DocBlockr (package)
  • Git helpers

...and many more. If you're a Sublime Text user, definitely take a look at his list and see if you can find something to help make your development easier.

tagged: sublimetext phpstorm editor ide features package tips integration

Link: https://mattstauffer.co/blog/sublime-text-3-for-php-developers

Gary Hockin:
Debugging PHP Command Line (with PHPStorm and XDebug)
May 07, 2015 @ 11:47:09

Gary Hockin has a recent post showing how you can debug PHP HTTP requests from the command line using PHPStorm and XDebug. These instructions aren't specific to PHPStorm, however. They can be used in any IDE/editor that supports remote XDebug connections.

At PHP North West I had huge difficulties configuring Xdebug and both my PHP and PHP Storm so they play nice in a CLI environment. So here, for others and almost certainly my future self, is how to do it.

He goes through each step of the setup process assuming that you already have the necessary software installed. He shows how to configure XDebug for remote debugging in the ini configuration, setting up PHPStorm to receive the connection and, finally, adding the "XDEBUG_CONFIG" environment variable to tell PHP to relay the requests back to your waiting IDE.

tagged: remote debugging phpstorm commandline xdebug configure setup environment

Link: http://blog.hock.in/2015/05/04/debugging-php-command-line-with-php-storm/

Matthew Setter:
Can VIM Ever Replace PHPStorm?
Mar 02, 2015 @ 10:54:13

In an interesting new post to his site Matthew Setter wonders if an IDE like PHPStorm can be replaced by VIM, a standard in the editor community for decades.

Is it reasonable, even practical, to expect that a 30 year old application can match a modern one? Is it conceivable to be able to code as well using VIM, said 30 year old application, as I can in PhpStorm, with all the IntelliSense-lead functionality PhpStorm offers?

He starts with some of his recent experience with the editor and some of the things he's (happily) found it can do he didn't know before. He includes a screenshot of a multi-pane view, explains what each is and what he can do with them. He points out that this example is Markdown documents but it can just as easily be used for code too. Finally he talks about the subject any PHPStorm user wants to know about, the IntelliSense functionality. Unfortunately, while there are some tools he mentions that can do similar things, they don't provide the context PHPStorm can deliver.

He ends the post with an interesting question: is IntelliSense the right approach? He wonders if having more context is a better answer rather than just the auto-complete handling IntelliSense offers.

tagged: vim editor replacement phpstorm opinion autcomplete context screenshot

Link: http://www.matthewsetter.com/can-vim-ever-replace-phpstorm/