 Ok, hi everybody, good afternoon, thank you for coming, I know everybody is a little sleepy because of the lunch and everything, so thank you for coming so much. So this afternoon I am going to talk about how to learn about the new things we have in Drupal 8 via the booking because there are a lot of new things to learn in Drupal 8. So upon me, my name is Eduardo Garcia but only my mother called me like that. You can call me Enzo and you can find me in social networks and github and et cetera using En-Solutions, this is my nickname and we know it's a new company, I just started just to be concentrated in providing Symphony 2 and 3 and Drupal 8 consulting just if you are interested, located in USA and this is the agenda, I am going to talk about dependencies, site, stores, services, roads, plugins and events. This is like the main concept in Drupal 8 that we need to be familiar with, we want to be became a Drupal 8 developer, all of them are new in Drupal 8, so that's mean if you are, even if you are a Drupal 7 developer, you have a lot to learn. So in my opinion, the UI for site builders or teamers, the chain is not really huge, we have tweak in Drupal 8, it's just for front-end developers they need to learn something new every three weeks because every three weeks they have some new framework in JavaScript, so I got some more, some more older than some JavaScript framework, so it's like every day. For site building perspective, the menus and everything is similar and actually they have a lot of improvements but this is like a little, with a little intuition, you could figure out everything. But for the backend perspective, everything changed, I could say almost 90% of the things are new, so all the knowledge we have is like, it's good to know but it's not functional now. So with which tool I'm going to talk today, I am going to talk about Drupal console which is a Drupal CLI and I am a commentator of this project. We have been working on this project for almost three years and Composer, which is your best friend if you pretend to be a Drupal 8 developer. So first let's start with the system. If you install Drupal console in your machine, the first thing you need to run is Drupal check. Why? Because usually we always blame the product, we never blame our environment and usually the most common error is we are not prepared to run a software and we are saying this software is a fraud but actually it's not. Usually you don't have the minimal PHP version, you don't have some PHP extension or even you are not available to connect to the database even if you are my SQL or SQLite 3. So with this command, it will be analyzed a little bit what is available in your system and if you are compatible to install Drupal 8. And how we do that? So when you install Drupal console, you need to run a command Drupal init and this command creates some configuration files and one of them is the PHP check and then this could be is a custom by your project. That means maybe this is the minimal requirement for Drupal 8 but maybe in your Drupal 8 side in your project you have a library that require a superior PHP version, then you could change what you want to check. Like it could be PHP 7 if you want but it's because it's specific about your project. You could check like again your particularity in your project is about how much memory is required to run the project and you could set this. All these values are just a proposal to have an idea what you need to check. Obviously the time zone is important to set. Also we have a list of extensions that must be checked that you have in your system. So the idea is you could include more based in what libraries you have in your system because this is for a standard. If you use something like integration with Salesforce or Melchin or something for sure you need some different extensions. Maybe for busy map or whatever you want. So you put here and then maybe you put it in your Git repository and then you are starting a new environment, you run Drupal check and you say hey wait a minute everything is okay but those three libraries or the extensions in PHP are not available so you need to figure out that before to start to work with Drupal. Now let's talk about a little bit about dependencies. As I say Composer is your new best friend. In reality for me Drupal 8 is a Symphony 2 application and usually people don't say that. For this reason we have a you download a seed file, you have some distribution in your structure folder but if you use Composer to download Drupal 8 looks different and it's because the proper way is like our Drupal application must be similar to a Symphony 2 application. Three months ago this was a security issue with some library I don't remember and this required update a library because the library was available from your document route but if you have a site using Drupal 8 structure all your libraries are in vendor folder so even if you have the problem with the code your vendor never must be accessible via web right and this is the way Symphony 2 works. Composer try to help you to manage all the all the dependencies you need to have. So for Drupal 8 is really new with people so we have a Composer JSON in our application. So Composer JSON are inside models inside teams or could be inside a big application like Drupal 8 or Symphony. Usually this is a file we change a lot and the first thing you need to do is validate the changes you include are not broken anything. People say Composer is really slow and it is most of the time but this is changing soon because they are working in some changes but this is slow because if you use Ubuntu or Debian maybe you are familiar with APT get stuff so what APT get stuff do is like when you want to try a library he verify what is everything in your system and guarantee that the new package is not going to broke your system is the same with Composer. So Drupal 8 have their own dependencies anytime you install a country model or a custom model they have their own dependency and anytime when you try to include something everything must be consistent so the process to check this consistency is really slow sometimes but there are some techniques to improve that but this is a complete whole session. So the first thing you need to modify your Composer run Composer holiday and then you need to get this Composer holiday if doesn't work you need to roll back and figure out what is going on in your changes. Now okay Composer show when you don't know the seed file for another Drupal.org you get a folder with all the distribution this is okay but the problem is like the idea is all this folder vendor is like a third party repository is that you don't need to take control about the version control so the good practice is install with Composer and put in Githin or the Vendor folder and then when you push or you share with your friends they only need to run Composer install. So after run Composer install you want to run a check about how many libraries have what version you have in your system you need to run Composer show so maybe you could ask and you say I didn't install all those libraries I didn't know but this is because this is a tree of dependency so Drupal.org needs this library and this and this and this so the amount of library we have is huge but then you can get a little perspective about this as you see none of them is symphony right I said before Drupal.org is a symphony application but actually it's like the most relevant packages but actually you use third party for a lot of frameworks like a same framework for feeds and we have some packages for phantom.js and so on so it's like we have a little Frankenstein but it's everything is orchestrated to work perfectly so don't surprise it's something sometimes your system doesn't work but it's because all those dependencies so now imagine maybe you are having an issue with a specific package so you try to install something and you say hey I cannot install this library because this library is not compatible and then you say I didn't install this who the hell include this wasn't me then you say okay first I need to check it out if the version I have is the latest version I have available in internet so I need to send the package so one important concept here you say you see it's Gossel HTTP slash Gossel this is how packages are structured so the first part of the package is the vendor so the vendor could be a company like sensual apps or a project like symphony or same framework or could be a person like me and solutions and the second part is the library itself could be Gossel could be HTTP client could be anything so this is the format and then I am saying okay please compare my current installation to check with the internet available thing what is the function and I could review okay here I am running 6.10 but the latest is 6.21 and it's in red sorry that means there is a security update between my version and to the online version so obviously this is something I need to really care about and I could check it out some other information like what is the REPL and what is the license and what libraries are required for these libraries so in this case if you see at the bottom so Gossel library is using another two libraries from Gossel HTTP vendor but could be external also so the reason because the tree of vendor is is really good big and it's really good to know about that so this is similar to Drupal status like we get how what models are updated what models needs to be a date what models need security things and it's simple it's a kind of intuitive so when we have a Jell-O they say okay your version is not the latest as Jell-O that's mean there are new features it's not compulsory to date but maybe you need to review and maybe there are nice features you could use and the red one obviously is like a you must do a date you can interrupt me you have any question so don't worry sure it's totally possible well not not possible that because the composer they verify that the other day you are trying to do don't have a conflict with the other libraries but sometimes not an easy task to try to be totally good with all dependencies sometimes you need to update several versions in different or intermediate versions to try to do that so maybe imagine you have this problem like you are trying to update a library that you don't know what you have and then we have the composer why that's is this library is is tall because it's required for this so in this example is a Drupal installation that have Drupal console and we require Drupal console but even if you don't have Drupal console this is a Fabian Potersian library Goat that require Gossel and this is another this is what they say Gaston.js this is a personal contributor and a small component library created for an individual and used for Drupal 8 and then your Gossel so it's not it's not simple like oh I am going to remove because it's not possible because you have another libraries so maybe you could decide it maybe to remove first the library who have the dependency and then install other it's similar like at the dependency inside of we have in models like how you cannot uninstall this model because it's dependent for another okay this is a tool created by Sensio Labs is security checker and what they do is they have an inventory about the security check reported for packages and models so if you have Drupal 8 installation and you want to know if your system is secure based on the security releases provided in libraries this tool check your composer the version you have installed check their inventory and say okay this is this is an issue that happened two months ago with Gossel that introduced a new release in 8.1 and when at that time when you run they say okay this Drupal 8 require Gossel and this has a critical issue this is similar like the Drupal status we have but this is a third party library you need to install it's outside Composer it's outside Drupal 8 but if you find it in Google's security checker this is a project in in available in GitHub okay so now let's skip Composer part and let's try to use Drupal console to try to learn a little bit so if you are in prediction we have a command to get the status similar to status reports in Drupal 8 in the UI so you get information about your PHP the extension not available and you get information about how to connect to the database and get information about what is the document root for the site and everything so it's like obviously this is the first step when you get a new site and then you need to run some performance or whatever first is run sign status right and this is good because you don't you don't need the Drupal user to do this because you have access to the database it's not a problem so and now we have the actions in our setting files even if you are using something like settings local or whatever you you have the availability to create a key value and arrive in your settings to be used to a way to provide extra information for our models this is a way to try to separate the configuration between the staging development and prediction and this is an example like if you are using a official account in prediction but then you are using to test a depth version for this Twitter account or something in staging in prediction and you don't want to push this among the environments so you create this kind of things and if you want to do a quick review about this you just need to run config settings the bug and I will be providing the current key value information in your site the last three is like a not the last two is like a custom but the others are like the the values when you install Drupal by default automatically you get a hash created and then you have a container for the Jamal's created in your website so in the Drupal console I know is is famous for code generation but actually what I am trying to show today is like a we have like a three or four kind of commands we have code generation but we have debugging that I'm showing to here and then we have a site administration commands to try to to use their system and we have this kind of commands like a to try to help developer in the in the whole process of development site the statistics is a command and I think could be useful to try to do an assessment or a site like I imagine maybe you are a front end developer when you get a hire to create a team you need to know how big is the site and what happened usually the clients they just provide the URL and they say just brought just browsing the website and then you will have an idea and obviously you could spend four hours doing that but the reality is not like that but if you run this command then you will have a better understanding a little bit with a strong numbers about how big is the site and what is important because you could say okay comment zero and then you say okay maybe they are using this cost I don't need to create a template for that good or maybe you could say okay would I have 755 content types so right so that's been okay this is all and I am sure all of them are different among of them so that's been it's a lot of effort in templating the same it's like I have to try to have a perspective you say okay you say the guy you know it's three times what you imagine why you say this is why so it's something so it's not my fault but at least you have a fund a foundation to say to the client is this is because your side is like this and if you don't have access to you could request to your client please stand the console run this command and then I will provide an estimation we have some commands also to try it test our functions is important to test with content but the reason we have some commands to create things so we have commands to create user note that's on a miss vocabulary is an extra and this looks similar to Jebel generate and is because right now in Drupal core we have a lot of things created inside the core one of the one of them is create sample data if you are trying to create a new field type you need to implement in your class a method call like that sample data so the idea is any content I could be created to make content by default so what I we did here and in Jebel do the same via UI is just collect the information for how many content as you want to create that creation blah blah and we call Drupal core functions and everything is created so the idea is you don't need to you don't need to install an external module to do this kind of features okay simultaneously so the idea is one of the most silly tasks that make most of the terrible problems in real life is put a website in production and this is because the process to enable cash disabled cash and these kind of things when you are going to production is like you need to click right and we are humans and we always forget the something so you go to production and say go live production is down and is for many reasons maybe the temporary director is different in staging than in production then your site go down and everything so we create a command to try to reduce the human interaction of that yeah so we have two states like a put depth and production so obviously you are going to go into depth we are disabled cage we are disabled CSS preprocess JavaScript preprocess cash preprocess usage and we are enable the views query output and collect statistics and enable the error level lock in our site so this is exactly what you do part of this task are creating using via UI by the idea is don't live a human do something that a machine could do because we always forget so you did the cash oh yeah and not really and then nobody was said you have to do this nobody do that and because you enable now you have an action to try to fee to see what is happening in your views and this is for the login errors so as you could see are the three four or five screens that you could do in one second using a command the second part of the side mode that is to put in in the book in the tweak stuff so how you do that and maybe this is complicated for some people maybe because you don't understand really well about services in Drupal 8 but you need to create or modify a new file inside your Drupal side which is services channel and then you need to put a specific entries in dot file and if you if you screw your side is now so it's better don't do that so we enable the auto reload for tweak we enable the cache and we enable the the book and we clear cash in our system as we solve when you the book the HTML in your jubilee installation you have obviously some suggestion about this piece of code could be completed in this case in the third in the top is like a we are using block HTML that tweak but if you want to be more specific you could use block Bartik search HTML that tweak is similar that we have this kind of stuff similar in in Drupal 7 but for front-end developer is really good but asking for a front-end developer say hey it's easy just modify a service jam on file you need to do it don't use that is only a space indentation and do this for is is it's not a point to do that I think but we are not perfect so how is usually we in the development process we screw our side and we don't have access to the database look for the reason we have a command to get the latest message so you just run jubilee database look the book and you could filter by limit or you could sort in the other way if you want and when you get the ID obviously you just need to run jubilee database look the book the number of the lock and then you get the problem and try to solve again command that could be helpful for people which without in software engineering background is the database table the book is you want to inspect what is your data way why this is useful because in theory when you run an update of a model you maybe need to have new tables but maybe the day fail and you need to confer this table is there maybe you can use it or maybe you need to have maybe you have a new field inside the table and now in many dupal console mod commands you have three or three parameters in this case if I only run database table the book I get the full list of tables but if I send a specific table then I could get the definition of the table and then you could say okay this is the update doesn't work because three columns are not there so I need to check it out what happened yeah the schema is the last parameter no this is the table the database you could do you mean in the schema you have our revision this is another command we have for that I don't I'm not sure if we include but it's updates you could run drupal update the book you could see if there are of the update spending and actually this is a good a good comment it's outside this conversation but sometimes when you are trying to there a drupal site maybe again we almost never out of data in our models right but then suddenly we get a security today you have 10 models to update one security and not no security but the problem is the update PHP in drupal until now it's like a all of days matter room perfectly in order to apply everything but if one of them fail you cannot apply anyone so what happens is people is hack the core or uninstall the model and this is bad idea because when you uninstall a model you lose data usually don't do that so I create a command is update execute that you could execute the day isolated per model and if you have inside a model maybe five of dates and the number five is failing you could say I want to play I want to apply the first four and then you okay you apply those and leave the the other pending but at least you could apply independently the security of dates in each model in this way your system will be a little more healthy okay you for non-technical guys we have a database client the image is loaded but it's basically open a client for SQL or SQL to try to execute queries and get the way how to connect to the database using command line so a storage so one of the big changes in Drupal 8 and was like the main the first announcement about changes in Drupal 8 was configuration management because it's a way to try to separate data from content right so we have we write these commands right config the book just to get a list of all available configuration in a standard Drupal 8 installation you have more than 200 configuration files but if you want to inspect what is inside those files you just need to send to pass the key to try to get the information so this is basic site information and we have commands to override or to change the values there but in Drupal 8 also we have a new concept state so we have data we have configuration management and we have a state so states are temporary values that are only relevant for my current installation that's been as you as you can see here we it's not in the list but it's like okay yeah it's the last time the Chrome was executed so this is kind of information you don't want to push in production because maybe will be have a strange behavior because production half is on SQL of lie and dev half is on SQL of lie actually sometimes when we create code like a to run a migration to store the last migration here and then we pass in production and if we transfer these values to production the migration is never gonna run because the watermark is here and maybe you are in reality you are here so you don't you don't want to support this so it's important for this command to try to to the book what is happening in those variables because sometimes and that's usually happened my code was in my machines was in a staging but in production doesn't work so when that happened the first thing you need to check is okay let's review the state variables all the values and compare with my system to say oh it's failing because this variable have extra number or whatever so we have commands to modify the value and try to restore our side again a state is not a single value right could be really complex could be objects or whatever you have in this case is like a to this what is what files are associated to the system team in this case is like a per team we have the info jamal file for that so maybe you could say why my team is not working and then you say oh why might my my new team is not listed is not listed here so obviously your team is never is gonna work but you have the option to edit and save and continue with the with your life services how many of you know what is a service perfect it could be 30 percent services is something we inherit from symphony for symphony developers is a simple concept but because in our history in Dupal we have a lot of people without computer science background and this is good so people who learn by empiric and now these people is feeling a little bit behind because there are really complex things related with computer science that you they need to learn so the idea of Dupal console is one of the ideas of Dupal console is try to help these people to get on board in Dupal a easily but services in this case is another story and any guess about how many services we have in a Dupal site installation by default almost 700's and the and the problem with services is like and it's about too much information and it's hard to try to find what is what is in there so from one of the things we want to do in Dupal console is like a the UI in Dupal 8 is for me is a point of view and a story right it's the point of view for site builders or for publishers but it's not the point of view for developers it's like a we are alone nobody like us so it's not like a it's not that way in the UI to see oh we have the service I am going to use this and then if you are getting Dupal 8 you say hey I want to do something and then what I could do so you need to swim and swim or drunk in the documentation to try to figure out something and do reversing generating and this is a nightmare and I know because I suffer so services in general let me explain this is services is a huge a right of object so each service is a object inside this a right with the whole information necessary to access content or some external service or whatever so some people say it's like a if you write a model and you want to expose the any feature in your model you create a service is like a API for a model what happened in Dupal 7 sometimes when we want to create a use of things function for a tear party model like a roles or API we need to use the ugly model include file right and this is it's like a really really old school so we don't do that anymore we if you want to do this if you want to expose what your model do like a flag or something you create a service and then you include a service in your model in your model and you use but how if you have 700 models how you there in mind what services is good for you so we create this command container the book and then we print this alright 700 so just to give an idea if you if you are a Dupal 7 developer everybody use the global variable user to try to determine if a user is connected or not the problem is this is no longer available so you need to use a service and what service unit you can use if you are 700 so with this you have at least the ID and you have the classes right so you could narrow this search maybe saying using rep to try to find maybe if you if you are trying to get the current user maybe you filter by user for session and try to inspect the classes and this is a short way instead of to read a lot of code into play so in this case just for for your information the service used to determine if a user is connected or not is covering users so this is the service you need to inject in your controller to do that and you could notice like a you you now wrote the search and then you get the IDs and then you pass as a second as a parameter and then you could expect quickly the class and then this car so I did the same and then oh for this is anonymous this is my service right instead off to say like what happened in the past is that you don't know the module and they all this model they they use login or not so you read the logic of the module and then you need to figure out but it's more simple to try to say I narrowed the service I need to check the methods and then I use is the same rotor the book we don't have a way well if you use a model name it web profiler you could get this information they're voting but by default is not there so by default in a jupyla installation we have about 200 rotens and if you see a roten means anything including variables inside so you could use that but and why this is useful so imagine and maybe this nothing happened to you but maybe you have your clients and they see a website page in your site and say I want the same but with a checkbox extra so just copy and paste and this is how the client thing it is right but in reality what you do is like okay the problem I'm going to say trust transmit the message and then you try to find an string to search in the in the code and try to figure out would be this code do that in this instead of to do that we need to be more proactive so you say okay he wants the same the similar feature in this page or form whatever it's okay give me the URL so using grab maybe you could narrow which URL match with the page the client one should get the ID and when you get the ID for instance the user login you get information about what is necessary to run to run this controller in this case for a user login ID is a form but could be a controller and when you get this information all you need to do is find this form in your code and now you have the specific form the client thing you need to copy and paste but now really in reality you could copy and paste and this is if you that's mean if you are using the proper tool you could reduce the time the the waste time you use to try to do something that the client never valued for that and obviously you get some extra information the thing is when you do this for each routing the output change because could be the permission the checking whatever they do and if this is a controller is different and if if I rest API change so the da is if this is also useful if you create your your own routing or if you think you create your routing but it's not working you do this and if not there basically you are screwed you are doing something wrong in your routing so it's a way to try to the book then yeah I am I am almost sure it's possible because this read the game we have the services as you should write right the routing is also another user right isn't it's in cash so when you write uh what you say is a router subscriber what happened is that change all your routing and push and putting cash so much to be available in the router this is this is why anytime you write a router subscriber you need to reveal the the the routing stuff events I'm going to talk about that so we don't have hooks suddenly right but now we have events so the idea and the problem we have with hooks is like a when we try to when did when do we try to determine what is happening a hook I am trying to implement it's really hard to to determine what's happening before or after my implementation so for the reason we have an event in the book you have the list of the books events available and if you pass something like a the kernel response then you could get what implementations and what order is executed for this specific event so that's when you say okay my output I need to get the output from this event and then I I could continue obviously you could play with the priority to do that sorry I don't understand yeah this is the order of execution so the same for plugins we do play is about plugins and services so we have about 45 kind of plugins so this all of them all of this with the id and the class implementation but if you want to determine how many blocks are implemented in your system then you have you have this list and if you want to get more information about that then you pass the latest variable and then you get the class and everything again this output change depends on the plugin maybe this is too simple but some plugins like abuse filter or something this information this is really useful for the developing and contrip as I said web profiler web profiler is like a x-ray for our services you get information about everything and I think in in in in my opinion you need to install jubilee with composer install jupal console then you install web profiler and now you are ready to start with jupilee and if you want to debug a little more this is a library for a symphony named bar dumper and it's a model named bar dumper and they allow to get this kind of output in our in our website to try to to create to structure things similar to krumo but I think this is a little better and this is all you'll have so if you have any question in the future so feel free to do a question in twitter using my hamdre and solutions and this is the hamdre for jupal console hello okay i'm just gonna do some questions i've got alex here thanks for the presentation very great and interesting one uh what is the command to get all the possible commands this is like it's jupal list jupal list and it will give you all the sub commands and everything else yeah so I could show you if I could get out here any more questions meanwhile I do this so you could get jupal list and we have our command separated by name spaces so if you want to get all commands related with generators so jupal list generator if you want to get all commands related with configuration like this configuration we have about 148 models commands no more questions that's cool um if we're gonna write or add our own commands is there like a way of doing that like I know with drush you can add this drush commands and you can add your own drush commands in is there one for your own commands yeah models yeah you have you can create your own commands actually in commerce they write their own commands for do that and then we have a kind of instructions so we have a command to generate a command inside your model nope i'm gonna go back to earlier you're doing some composer talking about some composer things and I saw one of the um one of the dependencies you had there had a something j s and questions come up I've asked it other people have asked it around me before was there are they like can you use composer to install java script libraries oh no no no no I understand your point again this is outside so I have an article about that about how to use reags in jupal 8 here and you I use composer to install reags and include that inside a jupal model inside jupal so actually if you find jupal 8 s e s 6 this is the first question the first response response in the Google so um we'll wrap it up there the final question I want to ask is do you have your bash prompt in as in a gist somewhere my what your bash your bash prompt ah this is fish fish oh okay yep so fish is like a souped up who's a souped up shell um okay thank you everyone please thank uh Eduardo Enzo I'd like to call him Eduardo as well