 So we start so good afternoon everybody. Thank you for coming to this session to learn the new things in Drupal a via the bogey So let to talk about a little about us. So Jesus. This is my business partner in a new company We recently started in USA name make we know because you know you know and So he is every he is like a 50% of the company And the other 50% like he is in charge of everything and They also do the world you travel Yeah so Eduardo here again as your partner did you venture in? And You don't want to miss Eduardo tomorrow. It's keynote community keynote as well. Let's do a member tomorrow So let's start talking about this So during the session, we will talking about how to debug triple and I mean, it's this is not about ex debug Sorry if you're coming trying to see this is more like debugging the different sub systems of triple like debugging not only code No, no, I'm not coaching the bugging, you know, we all know Drupal 8 has a new set of system like the storage system, which is we have configuration and state The new plug-in system. I mean, how are you aware? How many plugins are in the system? Can how can you find out all those plugins? Same thing for all the services Drupal provides with a lot of services when I'm talking about services I am not talking about web services and services Classes of registering a service containers. There's a lot of that data as well We have the new you know, even listeners events that happens at certain point when something happens. So there is This during the session will talk to you and show you how to do that. I don't know which pieces of the which pieces of those new subsystems are in the system and how to find them So we're talking about how debug also dependencies because now Drupal has Managed using composer. Well, not like default But you can use to take advantage of the composer to manage your dependencies And we'll see how this works and then we'll see how to debug the site as well How many you how many notes we have and trick formation about the site and Let's start with the dependencies and we'll show you some tools during this session that you might be aware of But I mean, it's always good to know So it's all kind of a Drupal console and a new Drupal CLI. I mean, you have you hear about it use it Yes, great And about composer and just just I mean avoid this line Composer is a package manager for PHP and let's start at first how to debug the system So maybe you inherit the website or you're starting and you say on someone is sales working in in a way in your website Also, when your team out in your dependency or update your composer file so But first before trying to start to work if you have the Drupal console in your system You will be able to run the check command It will give you an overview of your system if your system is ready to work with the eight because we all know The eight has some different Requirements than the seven versions. So we have it's this command. You check for all of the required dependencies of PHP are installing your system. It also check for some recommendations in the system So if you run this command, you will see something like this and this data is From the Drupal.org requirements. Let me show you this file reads or this command reads a file in your system Okay, once you get Drupal console You run the init command and this file did copy in your system so you can play around and this again This is based on the do Requirements so it also it's requiring you the minimum 559 version of PHP even when it's already in obsolete But that's how is in the requirement definition then you have some configuration So we are forcing here and I mean overriding some values So time zone is required Drupal console uses symphony console component and this and this configuration is required so daytime So we are for I mean setting daytime zone and mental memory limit. You can feel free to play around with this file It also has some you can also have some recommended configurations. I mean for your specific projects you can add it here And then finally the required extension. So again, this art took from from deal So again, you can just play around here at more or you can also add some recommendations If you add recommendations, you will see like message like, you know, yellow messages If you are something required that is missing, you will see the red ones and About dependencies again, we are using a composer and The first thing you need to do when you inherit the project is just run this composer validate command And this is what you should see, you know, your composer is valid, right? If you see something else and it doesn't something is missing or you have an extra comma you will see it here If you're this is commanding like freely great when you're starting to work in a project We have different commands again Drupal 8 it takes advantage of third-party libraries and symphony components So you might be can probably say, you know, I know a command or something to know which modules are installed I can have a list of my modules, but Drupal core depends on all the packages And you know, maybe the modules you load in your system depends in all the packages that are not Drupal modules So if you want to know which packages are Is your site requiring you can just run composer show this will lead you at least you a list of all of the packages The version currently the current install version and the description of this package again We are using Composer we start not even talking about Drupal because you know Drupal is taking advantage of Composer If you want to see a specific definition of a package What you can do is Composer show in pass as an argument the package you want to see and if you pass slash slash latest You will see how this right in this little message will see you will see the current version And it will tell you what's the latest latest version of that package available so you can download so you can run You know composer update for for that package And if you want to know If any of your packages is this It's outdated of there's new version for a package. You can just run composer update outdated here You will see again the package then the current version and if there's something new if you want to know I mean who is requesting a package? Maybe you have you know, we are talking about compose my be My side is telling me that I am requiring a gospel But if I take a look at my Jason composer Jason file, I might be do not find Gossel definition there. So who I mean why is composer or why is in a specific package on my side? You can run composer why and pause the package name? This will tell you which packages in your current site are required this step are required There's dependence and well finally remember the gospel issue the security issue a few months ago. Well There was an issue with with with with gospel and if you want to make sure your site is Not having any like like security issues. There's a project called security checker maintained by sensual people and You just need to run the isn't you as a command line that's based on the symphony component as well You just run the security checker and then the command is called security call check And this will read your composer log file. It will tell you if there is a critical I mean Unknown vulnerability of your any of the packages you are using in your project. It was something like that And it will tell you I mean what was what's what's missing? What's the current version now? Let's talk about your side now. That was can't sonic composer thing now Let's talk about Drupal and we touched that before because even you know, this is Drupal thing Drupal is using composer. You are managing your dependencies through composer. Let's talk about this Okay, so the idea in the Drupal console Maybe it's well known among you about the we have commands to generate code, but there is like a one tier or our commands I like to see the Drupal console like another story from the same Situation like the UI we have now web only represent one part of the data We have but that doesn't mean we don't we don't have more data So we build some commands to try to provide this information So a basic command obviously you have a Drupal side install inside status that will provide all the PHP specific version data As you can see some values you could get from the PHP file Obviously, this is important here the what database what version of Drupal are you using? so an indexing values and Also, of course some information about team. What is the directory? What is the data by connection? So this is basically the status report you can get from the UI In the other hand you could be more specific about what you want So we have a section related with configuration in Drupal in this case is config setting the bug with this information is like a you could have some specific settings for Each side in in case you want to to have some values in production different than in in local So maybe some system you use is not working like a maybe some Twitter integration So maybe you need to check it out quickly. What is our those values and we will in you could get inspection about this So this is reading your settings files is just showing you the data that I mean you don't want to commit that set I mean that API key is so you put in your settings files with you know, everybody Oops Okay Moreover There are some times that we need to try to get some inspection in the inner website It's especially for front-end people when someone requests. I need to do a team So it's really hard to try to predict how big is the is the site because obviously the team in is based in how Many content as you have how many teams many variables be used on everything Sometimes the client they only provide the URL and then you say just click and you will know how big is the site But obviously this is not the perfect situation Obviously, this is not a perfect solution But at least they will be give you some information about what is the structure or the of the website in terms The amount of node content types if they are using comments Obviously, if you see there is no comments Obviously, maybe they are using something like discuss or something but at least will be give you a panorama, so like a maybe you are higher if you are get hired for migrates some website and Then obviously the amount of node that the users and comments would be important to define the effort you need to do This is also really useful when you again you inherit that site from someone else You just import the database and they give you a quick overview of what's on that data If you I mean how many like no content types are here man Give you a like fast overview so you can see how this site was built Remember all these commands are open source are in the console and everything is OOP So in the future, maybe you want to extend this you have the option to extend those commands to try to create your own Functions not only just copy paste, but you can copy paste and create your your your own situation But it's like a this is not the final solution. So we the da is in jubilee Do we have this OOP situation? So we could take advantage of this in all the commands? I am presenting right now the other Command maybe is not related by the booking But it is useful to to the book your system is to create content So we have some commands like a create nodes You could provide some information about the decoration title and everything This is so similar to the devil, but it's so similar because now in the court in jubilee The process that we have for devil generate everything is just UI because the core inside They have on functions to create dummy content So what we do is just provide a UI in the CLI to call the core functions to do this And the good thing is now you don't need to install anything in your website So you have a jubilee console. That's it. You have everything installed and then you can take advantage of this Mm-hmm. Yeah, obviously they're oops That's just like so We think about the development process As you know now we are called full stack, right? That is like a to be in football turns we be a goalkeeper a Middleman and go to score right so you need to do everything And now we try to create some Command to try to help us in our daily process It's not only it's not only by calling to generate code and not only that you space the code So we have a command in this case for Try to facilitate the process to put into that mode or production mode It's just to avoid maybe you forget to click something in the UI and then suddenly in production Everything looks run and it's maybe because you you forget to disable whatever so in this case in the mode obviously what we do is we enable we disable the compress and caching and we enable the ui sql and For views Statistics and everything I show you show you the query that you're running and show you the time you stick into run some Do we increase your you your error level? And this is what it happens. So yeah, that's fine. It's one That's fine. This is something you could do here So what it happens when you run this command, you know, remember what it is It's basically just goes here and check and uncheck this but you get again, but a month of others clicks So yeah, yeah, yeah So that's mean you need to do clicking by this in production and maybe you spend maybe I don't know a minute or two minutes But why do that if you could do in maybe two seconds you want to make you again in you getting your side You just clone your side you put the database from the set of production You want to turn all those caches off to make sure it's working. What it's working in? Yeah Same with views Settings yeah, we can see here clearly Slides Okay, then okay, then then we didn't see the view thing but basically was Imagine what you saw is it's showing you the query and showing you the time is that is taken to to execute Then another thing that it's turning on and off is the login error So basically just turn from none to all messages. So once you have your site in your local You can see all of the messages, you know the Drupal set message thing in your in your site Then the final part of the command you have the side mode again the first part was Compressing say I says yes turning on off abuse thing and the final part it helps change in some settings in yours in your Services that Jamo file which basically turn on enough the tweak debug, right? So if you're a front-end developer or you want to know which you know Team is loading tweak block is be loaded. It's turn on this. Then you know the template suggestion Functionality this is something you need to do manually because you don't have an action to do this Yeah, yeah, and now you can you can change the settings that local here But if you do that you always have it so this using this command you have chance to like turn it on and off And this is what it happens So if you run the command again side mode that it will change the services Jamo file And you will be able to see the team suggestions in your source code and Basically, and obviously you don't want to have this in production So you run side mode prod to turn all the changes back to the original state and then just Again, you can just make sure you don't you don't explore those configurations So obviously this is a simple command to try to check the log But it's useful when maybe you did something really grown and your side is not accessible Never happens with Ripple, right? So at least you could check the the your log in that in database actually we have One command in process to include that is like I do a pool like to constantly reviewing to the dot Like a tail in the log but for this This is a contribution. I don't remember here from Europe. I guess. Yes, and yeah, if you as you could guess if you pass the idea of the log that you want to see each other the detail of the log, but it's happening and Sometimes again when you are creating or enabling our modules some modules create tables in your system, right? And you might be want to make sure that table was properly created and all those fields were properly Created on that database for the database table debug command It will show you all of the tables on the system, right? You don't have to like no, you don't have to like log into like, you know My SQL CLI typing user power because it's reading from the site configuration and As you can guess you want to see information Detailed information of a table you spat the table name and you will see and this is again really useful when you enable a module That creates a new has a new content type and end up is it's end up creating new tables in this system So obviously this is helpful for people who is not familiar with SQL commands And but if you really want to jump into the my is client you can use database client So this will pass all the credentials to your and my SQL CLI and will jump you into that So you can start like playing around and as you what you can see here is the database connection information This is because we have the learning Option turn turn it on in Drupal console. So these outputs more verbose data So it's not only executing the command it also telling you what which command was executed So it tells you right here. What was executed? Let's let's go here. Let's talk about the different subsystems of Drupal, right? Remember what we'll tell you there is storage There is events. There's plugins and there are services. So let's start with the storage one So the idea is like in Drupal now we have an storage for almost any different plugin and the first thing you need to know is No information about this in this case with configuration Management, we could have this configuration listed right now in a new website. We have about Configure Objects Yeah, good people, but it's more than 300 so the idea is when you configure the site the email the title contact and everything everything is stored in in In those files or any of them represent a jamal file and this is what you export and import we for everything which is not Data right like a node itself So when we when you get those files you want to get more specific the solution You need to do is you take the key and with that key You will get the information about your site in this case We are seeing like at the basic site information and we represent those pages again, this is a to Analyze faster. What is in your website? Logging going to config then configuration something and then going to like single Export things so you can see this. Yeah, she's running this So but outside configuration like the idea is configuration is something you modify in your developed environment You choose the specific file you want to put in production and then you see the changes in production There are some a new concept in jupyla which is states and this is information only relevant for your own environment like the last time when the crown was executed or if the CSS cache in enable or not or Different other values that maybe they are only valuable for us But obviously help us to try to the book and with some any string issue we have And the first thing maybe we need to do make us is normal. Maybe not never happened For you is like a maybe everything was perfectly in your system, but in production No, so it's the first thing you need to do is to review what states are affecting the Process in the production because maybe it's not a code Problem is just an estate value that doesn't fit with the logic inside your code and obviously Is that is the problem? Here you could say what is the value for the nested the book and it's like in this case system team files But it's not here, but we provide some command to change the state Yeah, the same for configuration you can go something like instead of debug state debug state State edit or override you say override you can pass the key You know the object and then the key and value so override it from CLI Or you can either go like edit and just edit in your in this case in production You go to the command to modify the state and then change the proper value it and now your code works properly But it's a way to try to fix the problem another new Things or your subsystem they will see us. There's their services. There is something called the service container simple thing services a useful object and You just put it in something called the service container in order to share across your whole application in this case your application is your website, right? and again same as configuration so Drupal has a lot of plenty of those so Container debug will list all of the services registered in the container. There are among those lists. It's like And then this will tell you what the service ID or savior service name is in which class is Register as a service. Yeah, I mean don't worry them complain is just like all this is happening here If you want to know more information about our specific service, you can again container debug So in jupy late There are right more than 500 services available to be used But as a developer while there is in the UI In the documentation, maybe but it's it's it's really difficult to try to know which services we have available, right? Actually, there's there's no way other than opening the core services Jamel file see which the files are what the service name So the idea is you can use to try to identify what services you want for instance in jupy 7 We use the global user guess what that is not available anymore So the way to identify with we user is connected is using a service is named current user So obviously you are a new developer. So someone say everything is services What you can do is execute container filter put user and then try to inspect a little bit about which services are related with users and In the site in this in the next slide when you get one service you could now identify what is the Class used to attend that service and then you could spend the inspect the methods to try to see if this is The method obviously you could see a key here the method But you want to really really see the code obviously you just need to go to the class To identify so it's a way to try to learn from the debugging to try to Identify quickly the information you need because the other wise you need to do reverse engineering It's like a check in the code Clicking kicking kicking kicking and inspect so you could spend easily hours on that right and Obviously your project manager will not be happy if you spend four hours trying to figure out something in theory simple Okay Let me explain this I always like this So as a developer or client or project managers they always say you know what I want That page or that form just almost the same but with some few changes So just copy and paste why but developers we know this is not true Why especially because when you came in a new system, you don't know how anything was built, right? But which looks simple for him is difficult for us So again, we need to do reverse engineering. So we see the form, okay? So Drupal is not like a HTML web page to find a test But we need you need to select something to search inside our code and try to do that our best to try to find Where is the code, right? And then we could spend an hour or something to do this But instead of to do that when we need to say to the client, okay? This is a report website with which page are you want to clone? So he needs to provide you the URL so you just need to run rotor the book Try to find a pattern because some routing requires on wikers When you you see like a bar or something but if you find the You could narrow the search and then you could get the specific Routing and when you have the specific routing for the page your client he wants All you need to do is pass the parameter for the routing and this command will provide you Okay, the confirm the URL is correct and then they provide the form and What information is required to render this page could be permissions because any routing has different information So now you can go to the form Exactly and do what the client thing you are doing copy and paste maybe change the routing or Extending and and this is the logic we have with this project It's like a we need to try to provide the tools that developers we need to be concentrated in the business logic Not in spending hours to doing some research that the users that the client usually they don't like to pay Yeah, so yeah, I guess it's basically this clerk is give you that made a data of the route and the dimension This is you know the class that is registers of using that route Yeah, another big big change and ripple 80s events, you know, we have events is something happening when you know I Want to execute this specific code when something happens like when page has a request or when page has a response You know and then we have in a system Where we can just see how when this happened execute this or execute that so all this data is registered on the system again on the Drupal system is Kind of hard to get information of it. So we have this event debug command. It will list all of the Events that you have raised around the system same as you can have with services in containers Everything has an ID or like a machine name that you can search for as a unique ID Running this command it will list all of those events in the system If you want to drill down more information, you just pass that Event type right and it will show you Specific information of the class that is registered as you know are responding to that specific event It also tells you which method it's responding. Let's say when a kernel response event happens then all this Services are or this class are executed and you can even know which method it's Containing the code that is really being executed at that specific moment. The good thing with this It's like a thinking about you both seven instructor. This is similar to hooks but the thing the problems I always face with hooks is like a Maybe you are trying to implement a hook But doesn't work and because something in the middle happened before or after and the output is not what you want and try to determine what is happening before me or after me was really Really bad for me. So instead of you you choose the event you want and this is the order and the methods Then you could never mind. Okay This is not working because after me my implementation Those are executed. Okay now and I need to change the priority or something and I will be good So we will remove this Issue we have before with Dupal 7 So another subsystem we have as plugins now as in the same way we have modules for extending, you know Drupal functionality Then those can contain plugins and pretty much everything is a plugin now, you know for matters of blogging a blog is a plugin you will find a lot of plugins on the system and Discovering the data. It's a little complex So we provide with this Drupal Plugging debug command and this is kind of the same Mean pattern that we see just run the debug command without any arguments and we'll see the list of those values And it's showing me and a specific plugin type here and which class is Responding as that But plugins are you know our type of plugin then this plugin can have some Implementation if you want to see more information about the block type plugin You just pass it just pass the block, you know the type as an argument. You will see something like this now It will tell me all This classes are registered as a plugin block of a type of blog for blogging and if you want a more in a specific information of one implementation Let's say I want to see what's the detailed information of like user login block that we can have you can see a listed here Then we have that information. It's a mix the exact cloud that is happening We know what the idea is who's provide the provider which module is providing this plugin in the system And yeah, it's like, you know, which category is this belongs to in this cases form So so we have a way of discovering all these plugins made of data Through that through the city So the idea is the same if you need to modify some blocks on one provide or any other plugin So I start off to go to the UI. I try to determine just you need the type the idea and then you go you can go directly to the code to do Whatever you need and we always show the cloud in the name space here of the class We're not showing the you know, that's the path the file path But you can guess this from based on you know, this is the module So it belongs to the user modules. It should be something in user and then you know There's a directory for SRC and then this it will mimic the directory structure on the file system So after the module name what you can find here is in a directory structure within the SRC directory of that specific module Which which modules have some which country module has some like also can help you to debugging this I mean when we start triple console, there was There was no other way of like, you know Showing or discovering these data then now you can find a Web profiler module that is great. I'm gonna talk about this the web profiler web profiler In the same way the triple console was built on top or seen for a profiler Luca is around here. Actually, she went to invite the beer. It's an Italian guy from Milan actually look Not here. No, okay But find him actually invite a beer to him. So the idea is in for symphony developers if you maybe Have the option to him like okay, you need to choose one of two you let ham or web profiler Mostly they will choose the web profiler because they don't need a left hand to code Because this is a really really important tool for them and look what Luca say We need to do the same and he built on top of a symphony profiler a web profiler for dupal No, no, there's nothing he's just mentioning and what we're profilers do is just getting or Registry data from the whole life cycle of your page. Let's say when From the request of the response It means when someone call a resource or a URL in your page until this resource or this page is like serve So everything that happens from this that sign point until the very end point it gets raised on the system and We're profiler. I'll argue to you know Discover that that data so you can see how long a page takes to load You can see how many forms we get loaded on the page when we finish we would show that an image But it's like a s-ray for the dribble website. This is our unit and and we all know in might be are using kint For you know debugging quick or like teaming right? so instead of you know for like outputting the That a huge array, you know render array, but there's another tool called bar damper Which is like really really great as well. It also it's a project from the symphony world That someone bring it to the world world and it's really really cool cool stuff as well It also allow you to like, you know showing data from the render array from there different things happening in your in your page And it's great because you can even have this data in a specific block and you you can just play around with this It's like a little more advanced version of kint. I mean, that's what I think about So you have any questions you can still ask GM olivas or N solutions or Dupal console You have any question here you can use the mic to try to record your question Just to get three quarters Okay, so so if you asked this is beginning because I just came in and some time after he started but in terms of caching the Output for this. So if we make changes to our code Add a new module or whatever if we what do we need to clear in order to rerun that debug and see our changes Those commands or what triple console do it's like always asking to Drupal and bootstrap in the Drupal for you So it's pretty much we will have a fresh print of that data on the system and Sometimes when you have a new service or when your module has a service a few times you need to run like you know cash reveal command Cash reveal and then all passing the argument clean all the cash Sometimes you need to do that from the UI from the CLI is always like doing that for you in advance So you don't have to run though and it also make sure when you're when you want to see if a module or for out What's registered on the system the module that contains that definition is install because all the data all those configurations Don't do not get loaded on the system until the module gets installed And once the module get install that configuration belong to the site and not to the module itself Okay, well, thanks It's this is the how web profiler looks And this is an aspect a specific inspection of all that request. Yes, you can see Has all of this functionality that we've seen in Drupal console has that been available since Drupal 8.0 was originally released or is this newer Which functionality? Well at this debugging functionality Which I mean I'm really impressed with with all these debug. Oh, this is before a point zero No, no, no, you mean if it's part of the no, no, we only Asked Drupal about there once it's registered on the system and we are showing you through the CLI So there's not so we are not not like really coding or adding any extra feature of Drupal all that we show here It's part of Drupal. The only thing it's So hard to find out and discover that information Okay, it's great things And you just adding about web providers once I got this is the bar that I show you so in here selling you know With if this page was loaded properly giving you a 200 code how long is this page takes to load? How many queries were executed on that page request and as you can see here this timeline thing This is the most awesome thing in the world. You can see how long each event process takes to get executed How long the page request was I mean? Take to execute how long your controller I mean delay to execute from you started and from the beginning How long do you know the rendering part of your views and is this is delaying to be complete completely render? Yes How do you see the relationship between Drupal console and Drash? Okay between Drupal console and Drash like what's the crossover or? there are just two different projects and I mean Drupal console. It's a again start as a boilerplate code generator turns into like full CLI The more people get asking features and sending pull requests for adding features the Drupal console is like, you know Code generator then it also helps you debugging the system And it also helped you what you know Drash has like interact with the system as well You know enabling starting modules giving you the user URL when you want to log in a specific user or the user's blog Give you I mean a way to like put your like produce that insane and sin I mean maintenance mode. There's a lot of things that can do but this is like it's a different project. I mean, it's It's a different solution. Yeah Questions All right, it looks really good. Thanks for all the work. You've done this My question is somewhat related to Drush again We've got a project where we've written some custom Drush commands that are specific to that project So they don't necessarily suit all projects. So by writing a few hooks and some functions in drush We're able to extend drush. Is there something in the Presumably, it's the symphony component that is generating this. Yes. Well, the way the extensibility how we can we extend? So this there is not a way to migrate commands, but we have a generate a command to generate commands Basically, you got you just need to provide the same You just need to provide the same arguments and options and the core of the your function It's basically just copy-paste. Okay, so basically you have a way to generate new commands But if you want to I mean add an extra feature of a Drupal console command, that's well Most of the functionality of Drupal console commands It's been moved or migrated to services and now Drupal console commands are registered as services So if you want to override a specific functionality of a Drupal console command You can overwrite or you can decorate or replace the service that is providing that functionality Sounds good. Thanks So as you can see the pro as you know, see we're following the approach most into how the house symphony Come in component works more like object oriented things again. So that's that's how you can well the how you should do Thank you for listening us You