 And we are ready to start. Hi everyone, my name is Sir Michael Vink. Thank you for joining me for the last, almost the last session for the DrupalCon. I'm really happy to see the entire room here. So my name is Michael or Michael, natively. And I'm working for JetBrains for PHPStorm Team as a product marketing manager. But don't expect any kind of marketing of sales pitch out of that because I was a PHP developer for more than five years before that. And actually, everyone in JetBrains is a developer, so I still develop on the everyday basis on PHP to prepare different demos and stuff like that. So we actually, we will have here a hands-on session and that's just beginning with that. You can find me on Twitter, Michael underscore Vink if you want to ask any questions. So just we will get back to those after this short talk. It's going to be for half an hour or something like that. So for those who don't know, how many of you actually use PHPStorm? Oh, that's good, that's good. So I don't need to actually explain what is PHPStorm. So it's a PHP ID with a lot of intelligent features and so on and so on, full-fledged and it has really advanced support for Drupal. So that's actually what we are all about here. So we will stop on this part for today. And actually a couple of years ago, when we first thought about supporting specifically Drupal development and Drupal developers to make your life easier, we tried to understand what problems can we solve. And Drupal support introduced about half a year ago in PHPStorm 7 and advanced in PHPStorm 8, we actually tried to solve some of those. So let's go straight to them. So first thing is that actually when you get in your tool and ID on an editor, there will be definitely some kind of learning curve and you need to invest some time in order to get everything configured. All the coding standards are experienced some problems maybe with configuration and we tried to make it really easy. So let's switch to the ID and actually see what we can do in order to get ID configured really easily when you're creating your plugin. Yeah, so the first thing are you got your new tool and you would like to set up a project. So we go to a new project and we're working on Drupal module for example. So we make it Drupal module tester one or something. And we need to select a project type and that would be Drupal module so that everything will be pre-configured for us so that we need to provide only a few things for that. That would be actually the path of your Drupal installation. That's Drupal 8 beta in my case but in fact that works pretty well in the same way for Drupal 6 and 7. So all the current and legacy versions are supported as well. So we choose that, we set a version number and we click okay and create a project in new window and it actually offers us to set Drupal style formatting coding standard straight away so that it will open it for us and highlight changes between default and Drupal coding standards. So we just can apply that and we can also detect PSR0 namespaces automatically and we have some more stuff here. So as we see on the screen, include path of the libraries from the Drupal core has been automatically included so that if we go in settings and we go to PHP, we see that all the core libraries are here and all the modules also here so we get all the Drupal API completion and in fact if you have for an existing project and if you would like to enable Drupal support there you just need to go to settings Drupal and enable Drupal integration here and if you have any changes in code style for example that's also can be set from Drupal or PSR1 and 2 for example if you are working with symphony components so that's really neat and all the coding standards will be applied when you format your code in the IDE for example before commit or something like that which actually contributes to the quality of your code significantly and apart from that creating a new plugin we actually get a skeleton, a basic skeleton for the plugin here in case of Drupal 8 that's actually a YAML file in case of Drupal 6.7 it's an info file and you have a completion here for some stuff like core and description and everything is highlighted so it's really easy to get it here and all the external libraries are also here as well but get into more details for example we will open a node module it's more advanced module just from Drupal 8 and the next struggle after the configuration actually we experienced with Drupal is hooks because hooks are not real function in fact technically in Drupal and that's a function you can't easily complete or navigate from or to in any kind of editor you need a special support from that because they're not recognized by any tool and there are really hundreds of them so we need to invest some time in order to learn them but in fact what we came up with is completion for all the hooks in Drupal core and all Drupal modules so that when you implement a hook in your new module you just begin writing a name of your module node in my case and it will autocomplete all the hooks which it could scan from entire installation and if you put some additional module it will also get scanned and it will be like really easy to get all the hooks and even documentation for hooks parsed from API PHP files so that we can navigate from hook to hook and see quick documentation and that's actually it yeah we need this hook we just press enter and it gets implemented in our module with arguments so we don't need to remember all the arguments as well and we don't need to navigate the documentation every time we need to explore some new hook so that's really neat thing works for all versions of Drupal as well and if we in any way would like to navigate to standard hook definition we can do it from the left gutter over there so that we can see here first information about hook in API PHP file if there is any and you can navigate from here straight to the place where this hook has been defined with all the standard structure with full PHP doc and from here actually we can get to all hook implementation so that we actually see what modules are implemented as hooks and from our hook we can also navigate to the invocation of this hook and in this case we don't need actually to go from one file to another in order to find information about what we are working with and with Drupal being quite a large code base we definitely need to explore what's going on in other modules and the core quite extensively so yeah and in order to help you even more with navigation to documentation you can navigate to specific page in the Drupal.org Drupal.org Drupal API documentation right from the editor you just need to get any kind of API method here and from the context menu it will take you straight to the documentation in the Drupal API so that's like for really fast navigation from here getting back on what we have else it's number eight yeah it's PHPStorm eight and that's Drupal eight in PHPStorm seven there is support for Drupal six and seven yeah but hook specific stuff and documentation specific stuff is pretty the same in all three versions of Drupal regarding some structure changes of course yeah which one? ah yeah so yeah we just here search in Drupal API so that's really fast and neat okay one more thing when you have your coding standard applied in the project you actually need to understand either you violate that or not and in order to understand that there is a great coder project available on github for Drupal and on Drupal.org and it actually a kind of rule set for PHP code sniffer and PHPStorm has a great integration with code sniffer in general so that the only one thing we need to download PHP code sniffer either from with composer or just straight from the repository and then we need to copy a rule set to the code sniffer distribution and getting back to PHPStorm I'll just open entire installation of Drupal 8 for this one we can go to settings and we can find PHP code sniffer to see how is it really easy to configure that because you just provide a PHP code sniffer executable and a couple of settings for example we need to be sure that inspections run with code sniffer are Drupal specific so we go to PHPStorm settings inspection settings and we need to enable code sniffer validation and we have Drupal here and many other frameworks as well so we apply that and need some time to get it re-indexed let's try how is it going here for some reason it doesn't like my live coding as a presentation but the issue would be that just a second let's try here maybe that will work smoothly sorry about that but that happens yes so we got information from a PHP code sniffer so probably I just need to reload the project or it's just an entire Drupal code base for quite a long time so here what we've got is information from Drupal checker for code style violation and it actually tells us that there should be only one space before Asterisk not two and if we implement any kind of hook here so for example this one will say as mission function or doc command and if we do any kind of function here and make incorrect indentation that will actually re-index it again and tells us that we have some more problems yeah so in some places here it will tell us information from PHP code sniffer and switching to the next integration with the tool popular in Drupal that's Drush, Drush is a command line tool which is very useful to update your modules for example or installing U-Module or I don't know migrate database and many other command line functions are available in Drush so what we have is actually neat integration with Drush so that you can run it straight in the editor and for that we need to go to command line tools and we need to configure Drush in the way that we provide a tool path we provide an alias for that show visibility, current project to global and then from tools and run command we actually can execute Drush straight from the editor right here with completion for different Drush commands here so here we had like Drush version and we actually can get any of those and all of that will be applied to your project it will be run in this content route where are you right now and that will affect your Drupal project which is really convenient in order to perform any kind of changes so you don't need to switch to any kind of different command line tool so that's actually the URL where you can get Drush and you need to install this command line tool and then point PHP storm to that and that's it and as all the previous stuff available for all Drupal 6, 7 and 8 that's actually interesting thing that for Drupal 8, PHP storm or any kind of professional ID is inevitable in Drupal 8 which is actually right now in better and hopefully will be released soon and a good news that in PHP storm 8 a couple of weeks ago we already supported Drupal 8 and we have a whole stack of features for Drupal 8 development so that actually the first thing needed to do in PHP storm 8 to get it enabled is installing a couple of plugins which you can find in settings plugins and here you can find symphony 2 plugin which has been developed by open source community by the way by great guy Daniel Spandiller and the plugin has now more than 800,000 downloads or something and that's the first one you need to install in order to get Drupal 8 symphony specific component support and another one is Drupal symphony 2 bridge which actually gets all their components from symphony to Drupal because the project model is a bit different so there are like many difference in how they actually operate and after that as soon as the plugin is installed you need to enable it in settings again so that you have enabled symphony 2 plugin for this project yeah and talking about what you can do with support for Drupal 8 in PHP storm 8 the first thing is definitely deep understanding of structure of both Drupal 8 and symphony 2 so for Drupal we already have seen that's about all the hooks that's about all the navigation features documentation and all the core APIs and methods functions, stuff like that and for symphony 2 as well that works for all components because there is a great symphony support that works for all components so all the code completion, recognition and resolve for paths and namespaces stuff like that completion, navigation and type inference and support for YAML files and we know that in Drupal 8 all the most of configuration for modules and routine and services is done in YAML actually so that it's already supported and tweak as a new default template engine for Drupal 8 and further coming from symphony as well there is support for all the directives and support for navigation there as well but let's get to some coding in order to understand how does it work actually so first you actually see that all the standard hook navigations for Drupal I've been showing around a few minutes ago I hear they are a bit more complex right now because there are a lot of symphony components and the code is now more OP defined and that means that its structure is much more difficult to understand at first but you shouldn't be afraid of that because we are actually trying hard to help you understand their structure for symphony and Drupal and all the components tied in together so yeah, navigation that's quite easy that's quite understandable let's get to something more advanced there for example, we can go to standard YAML files this one is a definition and information about the module a new module in Drupal 8 and here we have Drupal specific completion for YAML files so you see that it's info.yaml file and here it actually evades you to provide you information about dependencies, version core, some required other modules and stuff like that so we actually can complete some statements which is very handy but going further about YAML files for example when I go to routing which is actually a symphony thing ported to Drupal with some changes you can see that at some point that can actually be quite frightening because when you see that at first it's really hard to understand where you need to go and what is connected to that and you need to check many, many files to understand what it's doing and for that you need to just actually press control or control on Windows Linux or comment on Mac and you will be just navigated to following some routing statements which are accessible in symphony components so you're right here we for example navigated to settings form and that works for routing that works for service container as well and even for arguments in service container because that might be quite a difficult thing to understand as well at first not if you don't know symphony code base very deeply of course so that with simple click with a comment or control you can navigate between their files and understand what's actually going on in this class in this argument and stuff like that. So what else I wanted to tell you is actually support for Drupal's T function which is well of course one of the base methods from the Drupal API in all the versions and it actually scans your project and it provides you some of the options it could find right in the T method so that you can complete it here and that would be like much faster than going around entire projects and understanding what you actually need to put here and for sure all their other variables and all the rest which is provided by the ID is completed here as well and getting a new template engine in Drupal 8 is also quite a tricky thing because you need to really switch to a new syntax you need to switch to a new connections between modules and that might be quite a hard thing to do so we try to ease this switch with many, many completion, navigation and other goodies so for example, getting back to our T function for example straight in the tweak file we have all the filters defined in your code so that you can apply these filters to any kind of tweak variable or anything else in tweak so for example, getting back to our favorite T function we applied this filter T method to some string and we actually recognized that it's T and we got the completion for all the statements as well so it's like really faster to do and for example, if you would like to link from tweak file somewhere else we have all the tweak forms and tweak templates all of them ask hand so that you see that in the completion and you can navigate from here to YAML statement for this one, for this template so that you see what's actually going on here yeah, so this one is really good one for tweak templates if you are not that familiar with the syntax enough yeah, so I think that switching a bit further from Drupal 8 while still have a bit of time I switched to some productivity tips which I love to show so the first one would be actually very, very, very simple comment that's a double shift so with double shift we actually get a search everywhere control here so we can type anything we want so for example, we would like some tweak templates so it will find us so tweak templates all classes for tweak related stuff and we can just open it or if you want to go to symphony tool window we can just press here if you'd like to go to settings of PHP storm yeah, here we go we just went to settings from here so it's really fast thing to discover what do you have actually in your IDE and one more thing for very fast discovery is a productivity guide which is available in help productivity guide and here you see all the statistics of what you actually use in the IDE so that, yeah, I don't use for example, cancel, look up and move or I don't use file structure pop up so you can see here some tips how you can enable that and you can explore new features daily so that you make sure that you use all of them and here we're becoming much more productive for development, developing for Drupal and one more interesting thing coming with Drupal 8 is actually proper testing using PHP unit which is also integrated in the IDE and which also right now implemented in Drupal 8 and there are quite many tests there already so I definitely encourage you to write tests for your modules and for the core so that you can get entire code base properly tested which is a very good thing to do but when you do so, you need to run it and you need to understand that nothing is broken after this or that refactoring, for example so that what we need to do is only provide a directory for unit tests bundled with Drupal 8 and we need to have PHP unit file downloaded, for example, or get one from the composer and after that, we actually can run all the tests bundled with Drupal 8 or written on your own so we have like 1,600 already and it will go through all of them and make sure that all of them are passing and you can really see how fast is that and you have an UI right in the editor so if one test is not passing, you just click and you just jump to source from here so yeah, if this test wouldn't be passing we just turn negate to source and we understand that there is something wrong here right at this line so we need to actually fix that getting back to the presentation I want to show you some useful resources so the first one would be PHPStone website if you don't have it already, just download and try there's a trial for 30 days without any limits and there is Drupal 6, 7, 8 support there you should definitely check out and in order to do so, the entry point would be Drupal development using PHPStone tutorial which you can either Google or just get following this link so the video will be available after the presentation so that you can just get this one and go to the tutorial and all the Drupal related functionality is described there and you can just follow the guide and learn a lot of Drupal specific things yeah, and one more thing is a video tutorial directory at the PHPStone website and on the YouTube channel we have more than two hours of structured video tutorials and more than I think 10 hours of video in total so that you can actually follow different workflows debugging workflow, testing workflow Drupal development of symphony development workflow so that it's really easy for you to get better and get more productive with the IDE and one more thing is providing feedback for the session I would be really glad to hear your feedback on that and that's it for today I would be really glad to answer all the questions yes what kind of settings or actually using Drush? yeah, so the first one when we would like to get Drush in our project we just go to settings, command line tool support we hit plus and we need to add a new Drush tool because we need to associate your project with some kind of Drush installation for example, I've been installing Drush from the composer which is a very easy thing to do and we make a visibility for project it can be global as well and we provide path to Drush so that's in my case Drupal 8 biter, core, vendor, bin, Drush here we go, so now we have it duplicated so I just remove one of them yeah, so we are done here and all the statements there is a special XML file with statements for the Drush so that we have it built in and all the commands for Drush are predefined here and they are parsed from their official documentation so that it's up to date and we try to update it with every version so that this XML file is bundled and because of this file we get all the completion here so in order to open command line tool console we can go to tools and one comment and here we use it like a simple terminal so we begin writing Drush and then something what should we do, for example, Drush config that should ask us something, yeah so it's running and here we can provide an option right here, writing command line tool this one would be quite a strange one yeah, because it will try to open VI because of Drush, yeah put some, yes, yes so the question is can we run Drush and open or next to it something to grab or stuff like that so yeah, we have command line tool and we actually have a terminal which is built-in, which is a bit different because command line tool is actually for predefined command line tools so that we have all the completion for commands and stuff like that and terminal is a simple terminal in my case that's Mac OS 6 terminal so I just can do anything I would love to do so any kind of commands and there can be a few of them in fact you can open a few tabs of the terminals you can see between them back and forth, yeah sorry, I couldn't hear that yes, actually you can customize patterns because there is this XML which can be opened from the settings it actually not kind of encrypted or something like that so there is a documentation available on how we actually parse this XML and you can add some additional commands and you can also add some patterns and all the rest so you can just modify existing commands or create a new command, that's definitely possible some more questions? Tests? Yeah? I have, so do you have this core tests folder? So yeah so there are two things to configure the first one is configure PHP unit so that you need to click this run configuration, edit configurations and then there is an icon next to alternative configuration file so that is configuration for PHP unit and you need to get PHP unit from somewhere I've been getting it from Composer for example so that you can just, there is a link you can follow that, you download it to for example project structure and you show a path to PHP unit dot far and for the group you also need to put a default bootstrap file which is in tests folder and next to it I just provided a path to core test directory and that's it after that it will show this tick in run configuration that it's configured and that's okay some more questions? Okay, yeah, thank you, thank you Thank you