I think that the question somewhat disagrees with the rules of the project, but nevertheless I ask the administration not to delete the question. The question will be closed in exactly one week. I hope that the answers will be useful for both beginners and those who have long been engaged in the development of PHP.

Based on my development experience in php, I changed the IDE, the platform (the server with all the necessary stuffing), and placed the sources in different ways. I stopped at a not very usual version with crutches, which nevertheless completely covers my needs.

I would like to ask, and who uses what? Please be sure to include the following information:

  • What were your needs for PHP development software?
  • which IDE and platform (mince with server) are you using,
  • if there were non-standard tasks, indicate how you implemented them.

Update

I would like to raise the topic for the last time before closing it and read more new answers.

I was very surprised that no one unsubscribed about the platform using Git or SVN, or something else I do not know. I still hope for interesting and unusual versions of the working environment for PHP development.

I also want to congratulate everyone on the upcoming holiday.

Closed due to the fact that it is necessary to reformulate the question so that you can give an objectively correct answer to the party Nick Volynkin 26 Apr '16 at 4:48 .

The question gives rise to endless debates and discussions based not on knowledge, but on opinions. To get an answer, rephrase your question so that it can be given an unambiguously correct answer, or delete the question altogether. If the question can be reformulated according to the rules set out in the certificate , edit it .

Blocked by member Nofate Apr 27 '16 at 9:54 .

This question has been preserved because of its historical importance, but it is not regarded as a good question on a topic relevant to the specifics of this site , therefore we ask you not to consider it as confirmation of your ability to publish similar questions. This question and its answers are frozen, they cannot be changed. Read more: help .

Read more about blocked messages here .

    5 answers 5

    IDE

    PHPStorm, of course. In fact, this monopoly already scares me, because many buns are tied to him alone, and when switching to something else, a lot of time will be spent not on retraining, but simply on re-creating the functional. Of the ryushechek that are used less frequently:

    • File Watcher + Codeception + intermediate shell script (if there are tests / Unit / $ $ Test.php file - run it) = auto-tests that will fail with an error if something happens. Not to say that saved me at least once, but the mind pleasantly excites
    • The run configurations stack is almost ci-jobe. You can set up all the testing and analysis with one stack and run one hour before the end of the working day.
    • Running the same configurations in debug mode allows you to climb right into the test and see what fell. In a good way, it is impossible to do this, in an amicable way, such reports should be made for tests so that they can establish the root cause of the fall, but we never have time.
    • Connection coverage.xml and highlighting not yet covered rows.
    • Refactoring is an absolutely divine thing.
    • Code generation (alt + insert) - as a rule, I use it only for getters / setters and still parve PHPDoc, but a very nice thing
    • I don’t know how in other IDEs, but PHPStorm has a pretty nice namespace support.
    • Integration of PHPMD / PHPCS right at the level of backlighting sour lines.
    • Checking files before a commit is a very useful thing, even though I can normally use it only in my projects (time, unfortunately, is not enough at work).
    Web server

    nginx. Until now, I’m not freely guided in configs, but it’s somehow easier with him than with Apache (burn in hell, .htaccess) + in 99% of cases on production it will be him. PHP-FPM is configured for three configurations - dev, test, prod, but it never gave a serious boost. I am configuring with my hands what’s wrong about 100% - I still don’t know how it should be ideally (vagrant? Docker? Virtualbox + chef / puppet / saltstack?), But you can't do this with your hands. At one time, there was an idea to write a simple console web server configurator, but the project successfully stalled - in order to implement it completely, I first need to add a couple more libs that safely stand still.

    OS

    Linux Mint / KDE. Just personal preference. Well, in fact, on a home hospital, for several reasons, Windows 8, but in a virtual machine - Linux Mint. By the way - you should also organize your own environment through some puppet, because it is very painful to roll everything for the fifth time manually.

    Source location

    In my own way, I’m dumb, so I keep this structure:

    • / srv / http / src - real sore web projects
    • / srv / http / hosts - symlinks to sorts according to host names (for example, the playground project can roll in sorts, and playground.dev, admin.playground.dev, special.playground.dev can roll in the hosts)
    • / srv / http / apps - all sorts of pma, which I stopped using
    • / home / etki / Workspace - folders with symlinks on sorts + own projects that do not require a web server (library)
    • / usr / local / bin / composer - composer
    • / usr / local / composer - global composer folder
    • / var / cache / composer - cache composer. Together with the last but one folder, they turn the global visibility of the user-wide composite into system-wide
    • / usr / local / composer / vendor / bin - added to PATH

    For normal people, instead of / srv / http, use / var / www

    I will organize hosts with the help of dnsmasq (I just added a resolver to 127.0.0.1 for tld loc, local, dev, prod, test)

    Libraries, frameworks and utilities

    During the last months the following was established:

    • For PHP, there are pretty cool tools for testing and analyzing code - the phpcs and phpmd, phpcpd, phpdcd, php docblock checker (this is for such as I), parallel lint, pdepend, phploc, which can say a lot about code, are already mentioned. php-cs-fixer will also fix the code for you. Specifically for testing - athletic, codeception, the first, for obvious reasons, is rarely used, but when I manage to use it, I am happy as a child.

    • Opencart, Yii, Yii2, CI, Kohana, Wordpress, Joomla - fierce, impenetrable, which can never be used. Yii2 - the disappointment of the year, it would seem, all the crutches are already known, but still there is a rake at every step.

    • Right now there is a project to which to unscrew Yii and substitute symfony. This is no longer possible, but if I did migrate to Phinx (and I can do a pancake) and initially wrote a more portable code, I would still be able to jump between iterations over these New Year holidays.

    • Any apishka should be written through guzzle. It tritely repels in time. In addition, a mock plugin allows you to invade the course of execution once and twice and slip your answer, which allows you to develop an apish client without touching the apish itself. Another nail in the current project.

    • On packagist there are several virtual file system packages. It will take time to understand them, but with this thing you can test directly takes off to a new level.

    • Mock (no matter from which library, PHPUnit, Mockery, Codeception / Stub) is the best invention of mankind. This again comes up against my favorite testing, but when I finally began to use the whole bunch of these magical practices, I finally understood how and why the disconnected code is written (and why nothing could be more disgusting than a Yii tax object).

    • Wherever there is no template engine or there is a choice, it is better to use Twig. He and his hands screwed lines for five code, and removes most of the headache - you want, inherit the patterns, you want, implement the usual layout-system.

    Code Writing Practices
    • Static methods really cannot be used. Because if a specific object can still be replaced, then a static call always depends on the name of the class, which tightly drives the dependency into the code. This is not to test, and not to refactor in a short time. You can, of course, use $className::method() , but personally I have such an eye on my forehead. Any simple container will allow you to initialize objects once and be confident in the performance of the code.

    • ALWAYS, ALWAYS implement support for the dev / prod / test environment, even if it is not in the framework. When the project is blown up to a dozen apishki, it’s already late to implement this thing, because all the surplus goes to fast (and therefore bad) refactoring.

    • Whenever possible, support for feature flags and dev traits should be introduced (by and large, it’s the same thing, dev traits I invented for myself). Feature flags are simply a set of flags (booleans) in a configuration that controls whether certain features are turned on or off. This allows you to turn features on and off by hand, and in a dev, a feature may be unstable, but it can work and it can be turned off altogether. Or work stably, but expect a review from the testing department. Dev traits is also a set of flags that works only in the dev-environment and controls the additional behavior of the application that facilitates development: it fills out forms, hides elements, etc. In my current project, this thing saved me when I had to translate a giant landing page - I taught the translation component to tint the tokens with different colors depending on whether they were translated or not, and instead of empty calls to put a red stub about the absence of a token. Another flag allows you to hide the translation at all to hell, which allows me to see only the untranslated text.

    • Not a single config in the world should be written in PHP (hello again, Yii!). This is simply disgusting, such a config is impossible to write to the file again. Even if you restore the structure of the array, all expressions and inclusions will be lost. One of my side projects waiting for free time is a yaml-based configurator that supports simple expressionals like !include file.yaml / !realpath src / !instantiate \Vendor\Lib\Class , which finally allows me to work comfortably with Yii (well, what else).

    • I already wrote above about migrations - on any project that does not use the database structure that is deployed out of the box, they should be used; any step to the side is punished through a shot through foot. I once asked how atomic migrations should be - well, well, they should be as atomic as possible, one change - one migration. When a table is created in one migration, and then the subsequent creation of a foreign key fails, it shoots the second leg as well. Plus, in general, all migrations should be written with the expectation of the presence of data - you cannot make a column unique if there are already non-unique values ​​hanging there.

    • Interfaces first: where implementation is intended, everything should depend on the interfaces. This is a rather subtle point, for which I will not have enough abilities to verbalize, but if in brief with an example: the client of the apish should process not HttpResponse , but HttpResponseInterface . In this case, changing the library that implements network requests turns from digging up all levels of written code into writing a trivial wrapper that will meet the requirements of HttpResponseInterface . As far as I understand, this is exactly D in SOLID. Well, according to I - no interface should incorporate a million methods. Until I found out about the mozzle plugin for guzzle, I was going to write a similar functionality that would bypass the guzzle entirely and return the ResponseInterface object (a simple moka would clearly not be enough here). When I saw that there I would have to implement about fifteen methods, about 70% of which I have no idea - I felt sad about the order.

    • As a rule, any project practically makes you write your exceptions. In this case, there is a very useful hack, which allows you to set an exception handler only for the exceptions of this library, while maintaining the traditional chain of inheritance. This is done like this:

      • The empty interface is written.

         interface MahSuperLibExceptionInterfce {} 
      • All standard SPL exceptions with inclusion of this interface are inherited.

         namespace Vendor\MahSuperLib\Exception; use LogicException as SplLogicException; class LogicException extends SplLogicException implements MahSuperLibExceptionInterface {} 
      • Non-standard exceptions are inherited from those created in the previous paragraph.

      • After that, it is enough for any handler to catch the interface in order to catch only the exceptions of this project / project only:

         try { // ... } catch (MahSuperLibExceptionInterface $e) { // hehe } 
    • And the link to a pretty cool, albeit concise pdf http://www.planetgeek.ch/wp-content/uploads/2014/11/Clean-Code-V2.4.pdf

    And a bit more

    I don’t know how (I almost have everything at the minimum until the end of January), but in the near future I’ll pick myself a stack of jenkins + agents on docker + selenium + phantom + sonarqube. All previous simply fades after this chain is configured. Jenkins will allow you to run out any application tests, and Sonarqube is such a divine server of statanalysis of a code that itself calculates a technical debt and will tell you how much to refactor. It's easier to show once, see, this is an incredible creation, it can work with all major languages.

    So far I have been sitting on travis and codeship, I plan to try shippable too. Well, there are still a billion useful services (scrutinizer, versioneye, codeclimate), to which just hands do not reach.

    Sorry for the muddled presentation, later a couple more edits may be added.

    • I think you need to arrange it in a separate article. Useful experience - barseon
    • @barseon, I have a test manuscript for September: \ - etki
    • and it was not too lazy to write so much ... - Demyan112rv

    For Php in my opinion is ideally suited PhpStorm IDE. In any case, I tried a lot of things, it was not found better.

    I use Debian Linux OS for a number of reasons (not even because of a sharp dislike for Windows):

    1. The presence of the terminal and software, which itself is usually installed on the server (usually they are not on Windows)
    2. The presence of the necessary basic components, which are actually not too difficult to configure to configure, monitor and monitor the local web server
    3. Logging of all system and user actions, as a result of which it is much easier to find the cause of failures than in Windows, when instead of a clear answer you only see addresses where the error actually occurred
    4. Rather simple setup of the web server, not taking into account the finished assembly, which is full on Windows, Linux itself out of the box is ready to become a web server without any confusion with the settings. If the defaults are not suitable, then yes - you need to smoke mana and tune with your hands
    5. Raising a personal smtp server is also not a difficult task.
    6. And as for me, it’s much more convenient for a developer, it’s been more pleasant and more comfortable for me to work with the console for a long time, rather than using a mouse to puti for putty, putty key generation and other derived tasks, Linux ssh is much more convenient to use
    7. From software I use PhpStorm as IDE, Navicat Premium to manage the database, nginx + apache (hang on different ports) + mysql + postgresql + mongodb + memcached + redis + postfix (as a mail server) + webmin (tool, works as a web application , https: // localhost: 10000 to run, which is for beginners or people who don’t particularly want to pick the settings of the basic components, configure everything with a mouse click, I configure samba via webmin, I somehow didn’t work with the config, I found webmin and scored - I didn’t understand it anymore, because I didn’t want to dig really deeply, and I don’t want to - it’s sharing, it’s fine, and it’s okay :-))

      IMHO, NetBeans 8 is more than enough for a web developer. Prior to version 8, they somehow ignored the existence of HTML5 projects, but the new version of IDE was very successful, especially the built-in lighttp server.

        I’m not a professional yet in web development, but I’ll say what I use: PHPStorm for most tasks, or Vim for SSH access if I get some simple freelance order, and I need to fix a few files on the server. I deploy a local environment with the parameters I need to study / just play around with PHP / Pythone / Node.js and configure it on my local PC in 15 minutes using Vargant.

          As IDE I use NetBeans 8 (in option for php).

          But as a platform I use an unusual solution: VirtualBox - as a virtualizer. Debian (32 bit version) A bunch of Apache2 + mysql + php + sudo + GuestAdditions 2 network adapters: 1st NAT, 2nd virtual host adapter And a forwarded shared folder with a code that is mounted when the system starts, located in the DropBox folder.

          I will not say that the solution is the best, but the following tasks are best solved:

          • net operating system without a heap of various unnecessary services (if you refuse Netbeans in favor of Notepad ++, the system will be even cleaner)
          • the ability to quickly launch and reconfigure such a platform (if you make a customized backup in advance), it became possible to work on 2 machines
          • arrangement of project files in a convenient place and their synchronization