 All right, so it's one after so let's get this thing. Let's get this going So maximizing composer. I'm sorry. I will get you to your beer. Well, actually, there's nothing really stopping you Mike. So Don't let me stop you Maximizing composer so for the past year I have been giving another presentation that some of you may have seen I'm taking maximum advantage of composer and now this is maximizing composer. So it's completely different I actually left a lot of the beginner stuff behind and we're gonna focus more on the solid intermediate stuff more on plug-in stuff a couple of Examples that will do live because you know why not and then we'll talk about composer to and how freaking awesome it is Just from a speed and memory usage standpoint. That's really You know, if you're really tired and you don't hear anything else I say Start playing with composer to because it uses a lot less memory and it's a heck of a lot faster That's really all you need to know about maximizing composer. It's just use version two But we'll get there. I'm gonna that's the tease because those are like literally my like my last few slides so There we go. Let's Click that that okay, so if you would like to have a copy of these slides, there you go Bitly slash max composer to and I will oops. I was here. I'll put these right in the chat right now. I can't type l y Flash max composer to There you go, if you want the slides grab them from there, please All right, so what is the plan for today? Let's talk about the plan We're gonna talk about some version constraints. I'm not gonna go too deep, but I am gonna talk about a few things that If you don't know them yet You should know them and if you think you know them and then you see what I have to say and then you're sure that You know, then then I'm then you know, then you have a little bit more confidence Which I think is what a lot of composer stuff is just gaining confidence We're gonna talk about some plugins. We'll do a couple of plug-in examples a couple of my favorites and a couple of examples that I use just about in every site Conflict resolution dependency conflict resolution, so what happens this is basically the oh something went wrong What do I do section and I'm gonna give you some tips I'm gonna give you the stuff that works for me the vast majority of the time I'm not all the time, but What we'll talk about it as we go we're gonna dive just a little bit into the composer doc lock file and I cover this I Been talking about this for a good four or five six months Now in the various composer classes that I teach. Thank you Luke for making it clickable much appreciated Um, but we're gonna talk about composer lock file, then we'll talk about composer two versus composer one and then we'll be done Then Mike can go have Mike. I'm not talking about not me in the third person Talking about Michael K in the first person he now I guess I'd be the second person You can go have a beer and if you scroll back in the chat, you'll see what I'm talking about All right, so version constraints Carrot verse tilde Now I don't know about you, but when I not even when I first started using composer Let's say solidly for the first two years of me as a composer I was too lazy to really dig into like what's the difference And I was just kind of confused a little bit and I would be a little bit of trial and error On which of these I should use and what each of that means until I finally decided I'm gonna You know, I'm gonna start teaching this So I better like come up with a with a good uh definition and basically this is it. It's actually really easy the Carrot locks the major version It locks the first digit of the version And the tilde allows the last digit specified to float And by float it's really increase is what we mean So what does that mean if you do a tilde 2.0? I'm sorry like a carrot 2.0 That's basically saying you're willing to accept everything greater than or equal than 2.0.0 And less than 3.0.0. So it locks the two But the dot oh and the second dot oh are allowed um, the asterisk is uh, you know 8.8 dot asterisk is the same as a tilde 8.8.0. It's a wild card And Sean, I don't know if you're just messing with me with that question or not. So I answered it like like you were serious. So um Carrot 2.0.0 is equivalent to the same thing So it doesn't matter with carrots. It doesn't matter if you specify that third digit or not Um, it basically is just gonna lock that first digit The tilde tilde 2.0 is equivalent to carrot 2.0 Which is equivalent to everything more than 2.0.0 and less than 3.0.0 But as soon as you specify that second dot zero in 2.0.0 Now you're limiting yourself to things greater than 2.0.0 And actually that should be greater than or equal. There's a typo right there There should be a little equal sign right there greater than or equal 2.0.0 and less than 2.1 So in this case, it's just locking that last zero Uh preferred method. No, not really. I mean if you need to if you're working with a dependency and you know that the next minor version You know introduces a change you don't want and use you know tilde 2.0.0 And that'll that'll lock down the second digit as well as the first digit and allow that third digit to increase um Otherwise, I mean composer uses carrot by default When you say composer require vendor slash name Inside of your composer at jason you'll you know as long as it has a stable release inside of your composer at jason composer will put carrot major version dot zero Um, so I don't think there's a preferred method. Um, there's the default method. I would say But I tend to use both depending on on what I need Uh, a couple other things pre-release versions um If you throw an at beta After it, they're not only will you get everything in this case greater than or equal to one in lesson two But if there are more recent if there's a beta or an rc version. That's more recent than the latest stable You'll get that instead So that basically allows you to get ahead of stable If you want a specific beta version This is the syntax So notice there's no wiggle room here meaning there's no carrot. There's no tilde But if you know that like beta three broke something that but beta two has something you want without something broken or whatever You can ask for a specific beta with this type of syntax Um, and then the dash dev is the one that that that is tricky, especially if you're committing dependencies to your repo Um dash dev is going to get you exactly what you're asking for the dev version being in the drupal community We're used to You know seeing dev versions and you know, these are things before that a beta or a or stable release gets tagged But when you do request the dev, you're it's going to be cloned as opposed to downloaded Most of the time composer is just going to download a gzip and extract it stick it in your vendor directory Stick it in your modules contrib directory and off you go But as soon as you you slap a dash dev on there and you start cloning, you know, and you're asking for a dev version Composer is going to clone that down to your local Or into whatever environment you're working in So if you are committing dependencies to the repo then now you've got a repo and a repo And now you've got a git sub module situation Um, so there's a few ways to handle that You know the bottom line is you generally have to get rid of the dot git A directory inside of that dependency And you can even get super specific You know, you can actually tell composer that you want a specific commit from a specific branch And that will clone Um, I just stumbled upon this one day while I was you know in my leisure time reading the get composer.org documentation As I'm sure all of us do in our in our free time Um, but I stumbled upon this and I said, oh, that's really cool I I I haven't needed it yet, but it's there if you know if you need something super specific Um, it's there So this tool, uh, it's a cool tool if you are still like a little bit on the fans about understanding version constraints try out this tool so Um, let's go and let's say we want to check out some versions of twig So and I know that I did not create the site. So the I know the contrast is horrible So just you know, don't yell at me you can take out your anger on someone else for that Um But you can say, okay. Well, what if I if my version constraint is just one dot o dot star And I'm sticking with stable releases um You know, I guess there are no one dot o dot star. Yeah, there's yeah the first release was of one dot three So here let's do the one dot eight dot star One dot eight dot star as a version constraint allows you to access to those four But what happens if we do let's say a tilde one dot eight dot o in things Happens if we just do a tilde one dot eight We get rid of the dot zero now that dot eight is allowed to float Or the eight the minor version is allowed to float So we get everything from one dot eight all the way up to one dot four three because this thing is allowed to float Um, and what happens if we change that to a carrot Well, in this case nothing. Whoops, especially if we put both of them in that's it Yeah, pretty much the same thing um You know, let's say we allow or minimum stability for our project allows release candidates and we get this one filled it as well so this is a really cool tool to just kind of mess around and Visually see what these version constraints are doing. So definitely check that out if you're nerd about this stuff like I am All right, here's a little quiz. So pop quiz for everybody. Um, oh, okay I don't give you the answer here, but are are these two things always equivalent if you compose if you do a composer require on vendor name one And then a composer require on vendor name two Is that always the exact same thing as doing composer require a vendor name one vendor name two at the same time Just the fact that i'm asking it and the way i'm asking it should give you an idea of what the answer is anybody want to uh Grow out on a very stable branch That's a git pun by the way Yeah, the answer is no um So consider the case where you have a dependency that requires another dependency but the three dot x branch And then you've got a second dependency that requires an earlier version Of that same name three. I know my naming is horrible. I should have named these after like You know hair products or something um, but I didn't so Oh, gee, sorry So think about it if you do a composer require Vendor name one hit enter you're going to end up with version three dot something of The name three dependency And then in your second step if you go and try and do composer require vendor name two You're going to get denied Because you already have version three of name three. Yeah, these names are really terrible. I'm going to change this tonight. I'm sorry Um, but name two requires version two of name three um So really the solution if you've already gone that far is to basically If you can if you can see what's going on you'll have to actually remove vendor slash name one and either reverse the order You know do a composer require on name two before name one Or sorry Or require them at the same time composer require vendor name one space vendor name two and let composer figure out which version of name three is It is needed So just be be careful and think about this stuff um, and we're going to talk about like What happens when you get into situations like this? Like what's the best way to solve them in a few minutes? Let's talk about plugins out because for me Um, like if you're a beginner composer user, I think you're doing a lot of stuff just by memorization Like you know that I need to add something so I have to type these things and on my keyboard and hopefully it'll happen And if it doesn't I'm screwed um But once you get comfortable that Really composer plugins. I think are the next step like I feel for me at least Once I really got familiar with plugins then I felt like okay. I was a solid intermediate With composer with with the tool itself um Yeah miles no no We're not going to have that kind of talk here miles miles france. It sounds like a um, like a like a spy name Like a super spy type thing anyway So composer plugins I think once you get comfortable with these and even once you start seeking out more plugins like that aren't Drupal related. I think that's when you really become like a composer intermediate user so if you're using, you know, uh, the new template that You know came out with Drupal 8.8 the Drupal recommended project You're using composer plugins. There's actually three of them in there You got composer installers, which allows Drupal modules to live in the modules contrib directory as opposed to the vendor directory Drupal core composer scaffold Which takes files like your index dot php and your ht access file and moves them out of the core folder into Like your your web root where they belong And by the way, we'll do a demo of that later. Let's say mess with your scaffolding files on the way Um, oh, this is actually not true. This here. I'm lying already. So Composer patches is not included. Wow three. This is what happens the first time I give a presentation I find all the bugs not while I'm preparing but while I'm actually giving it um composure patches is not part of the recommended project template, but Um, you know, a lot of folks use it. So we're going to talk about that but this allows you to apply patches to any dependency Just by adding some, you know, some information to your composer at Jason. It really makes patching Easy and approachable Yeah, so I actually wrote a blog post a few months back about composer plugins. Here's a short url a short ish URL for it And I broke it up into sections like here's some must-haves. Here's some ones worth Considerings and I really only have one in the section of don't consider it And I feel every time I mention I feel guilty because it's the core Um, uh core project message one it actually it's part of Drupal core and it's a little Plugin that whenever you do a composer create project on Drupal recommended project project It gives you a nice welcome message and it's very nice and it's very happy and warm but Once you see that message Get that get that thing out of there get that dependency out of there All right, so let's do an example. Um, I'm actually have two I actually have two examples set up so core composer scaffold So I don't know if uh, many of you are aware but starting with Drupal 8.8 All of those scaffolding files all of the core files that don't live in the core directory Actually are included in the core directory Um, so if we come over here, I've got a Drupal 9 instance And if we just do a real quick ls-al web slash core slash, you know, you'll see an assets Folder and look it's got scaffolding Oh scaffold and then it's got a files. Look at that. Here are all of the scaffold files And they're kind of buried inside here. So here's like the Drupal index.php And you know, this doesn't you know, this isn't going to do much living in here It really needs index.php needs to live in your doc root out here So what does the scaffolding plugin do? It basically runs after, you know, basically Composer install ish commands. So, you know, create a project require remove update commands like that and it basically copies scaffolding files from deep down in core to their proper place in your project So this is a heck of a lot more efficient than the old scaffolding plugins. This is pre Drupal 8.8 days The Drupal Composer Drupal project days That scaffolding plugin was basically just a script that downloaded all these files from Drupal.org Every single time that you like ran a composer command that that was super inefficient So this is a lot more efficient and It's a lot more flexible because you can like get involved in the process So, um, so this is the readme file. This is the main readme file. And if I just do a quick Oh, I already got rid of it, so Hang on a second. Ah boy boy boy Pico composer.json. Let me That probably just did this demo and forgot to oh my gosh, this is embarrassing. Look at that. I already did the demo Me the time machine right here me Nothing to see here Poser install Ignore what I'm doing here. There we go. Okay. And look at this. It's like it's like it never happened once I do that So like there's the readme file the Drupal core readme file that we all know and love and you know really do we need this Like does this need to be part of your repo or does this need to be you know on your you know production environment? No You know probably install that txt doesn't either Um, so there's some low hanging fruit here files, you know scaffolding files that we don't need they're they're helpful You know, I guess when you're first starting get getting started with Drupal, but you really don't need them Um, and you know something consider these a security issue because they make it real easy for Um, someone, you know trolling the the internet to figure out, you know that you're using Drupal um so Let's get rid of them. So I mean, obviously we're gonna, you know, we'll be both of them. So let's just you know, we're gonna just uh Let's just rmm them first of all, right? So let's just get rid of that and rm Install, okay, that's all great. And yeah, sure they're gone But you know the next time you do a composer install Guess what that core composer plugin is basically just gonna say, okay, I'm gonna recopy them and poof. They're back So let's let's get rid of them for good. Shall we so how do we do that? Well, we have to basically Configure the core composer scaffolding plugin to we have to tell it. We don't want them back um So let's get rid of them again No, so so they're gone now And let's come over here to and I'll just grab This little code. This is actually the stuff. Hold on. Let me come over here where I can copy and paste stuff easier Copy that come back over here. What do you do? So you edit your composer got pasting file And then you come down to your extra section and the extra section of your composer at Jason is really all of the settings for your plugins So the scaffolding plugin Is looking for its settings in something called Drupal scaffold. So you can come here and I'm gonna put a comma there and I'm gonna paste that and I'm gonna paste it again Actually, no, I don't need to paste it again. That's silly. So let's just uh Get rid of those And so it's gonna be we're gonna change the file mapping and what are we gonna do? Basically, it's a it's a two from scenario. So the two is on to Not number two to is on the left side of the colon So copy to here And what do we want to copy from nothing? So in other words, don't copy anything to this in other words. Don't create that And that's really all there is to it um So let's actually do that twice For the install file as well web root install dot txt false And I think that all looks good someone yelling me if you see something Um, I love let me do this just I love composer validate This basically tells me if I have a you know a missing comma or something And it looks good and we're gonna talk about this red lock file stuff in a minute. Um, so our composer Dot Jason is valid. Now if you do a composer install um We're skipping look we're skipping because it's overridden. It's skipped. Yay No more install and read me file so easy to do You know, if you're not going to use a little built-in php um Web server, I think this is like the configuration for that Get rid of that as well You know, I'm all about keeping things as lean as possible. So if you don't need, you know, some of these scaffolding files Then acem is what I say Um, so I got another little quick example here and you may have seen it come through It's one I've already put in there, but I'll show it to you anyway. So I actually have Let me come in. Okay. There's another scaffolding thing I'm hitting an assets directory on my project route And then there I basically have a patch So I basically created a patch for my ht access file because I want some special stuff in there in the ht access file Um, I don't want to delete the ht access file. I just want to patch the one that Drupal core gives me So this is just a regular old patch. Um, you know, I can show it to you not I think big it's basically getting rid of this stuff um, and again, we can You know, uh, Sorry We can pico our composer jason And this is not in the extra section. This one works a little bit differently. You have to go down and actually have a little script There's actually a it's like a Drupal hook, right post Drupal scaffold command. So this is like hook Drupal scaffold or hook after Drupal scaffold if we want to, you know, translate this into Drupal ease So here's a script that's going to run After the Drupal scaffolding plugin runs every time and what's the script? Well, we go to the web directory and we apply the patch boom Ht access is path patched So basically what this is is Next time there's an update to Drupal core if you have special modifications to your dot ht access file You don't do anything You can just, you know, let this run and as long as the patch applies cleanly, you're good to go You know, obviously, there's always a chance that core is going to change the ht access file And then your patch may not apply cleanly, but that's definitely not going to be every time Um, so you can also append Um, so I use uh the appending and appending you can do up here and extra Um, so you can actually append as well. So that's good for like a robots dot txt if you need to append to the to the end of that So a lot of really cool stuff that you can do with your A scaffolding With the core scaffolding tool, so definitely use that because it's a good one Composer patches, you know, once I saw this and started using this I don't know how anybody like manages the Drupal 8 site without this Because that's pretty rare these days not to have any patches on, you know, core or contribe I'm not saying, you know, everyone has a patch on core, but most sites of signal, you know Anything but the kind of a smaller site Most sites are going to have at least one or two patches maybe in the contribe space Um, and this just makes it dead drop dead easy to to to to do um So basically you require it um, see weagons cameron, uh eagons is actually a um, he's been a long time Drupal community member, but he created this as well um, well actually he he forked another Um dependency to come up with this, which, you know, I think a lot of folks are using now Um, so what we're gonna do is we're gonna patch draggable views and I gotta go here again I'm sorry and see so let's just pretend We come over here we go to draupal.org slash node slash this, you know, we're using draggable views and everything's great, but Oh my gosh, it doesn't work with the group by feature views And I need it to and it's not committed yet. It's just a patch out there So let's say we want to apply this patch and I forget which one we're using now I probably have it right here patch number 40 So we're gonna patch it with uh, yeah, uh this patch right here the latest patch So we come here and you know blah blah blah patch patch patch. Here's the url Well, first thing we need to do is we probably probably a good idea if we had draggable views Those are required Drupal slash Draggable views so this just shows you pretty how fast composer two is it's it's pretty darn fast And it's done. That's lovely and look we still don't have uh, you know installer read me So now that we have that So let's come over and we're going to get this syntax and the syntax is pretty easy, but I'll Walk you through it because that's kind of what presentations are all about right eco composer dot Jason And we're gonna again come down to the extra section So I'll put it right at the top of the extra section. So it's What's obvious Oh Why did siri siri just did I say something that was close to siri a second ago? Ralph I see your question. I will uh answer it in a second and we're gonna paste And let me just get all of this all nice and pretty Oh, I should know I want to do this right uh a lot of indentation here one two three four Line that up two three four And then one more thing we got to do. Let's just get this I'm two three four. Hopefully hopefully don't miss anything up too bad there All right, so composer patches basically looks for Extra settings and using the patches key And then you provide the vendor and name of the dependency So Drupal draggable views is the dependency that needs to be patched And then it's an array and then each one Each line basically has a description So I tend to use the you know the same as the title of the issue Right not working with group by feature not working with group by feature and then it's literally just this is just a path to that patch Oh, I mean, you know, you basically come here and like oh, I want to use this patch Copy this Paste it there and you're done All right, so let's x out of that and save. Let's do a composer validate to make sure we're good We're valid and let's just do a composer install And Let's see do not Let's see nothing to install Did not see it run there Uh composer Why did not it not run there I miss it. That's it. No. No. No. No. No patching file Oh, wait a minute Uh, do I have composer patches installed on this? You go composer updates not gonna be the whole problem Oh, look, I don't have composer patches. So it would be a good idea if we actually have the dependency I skipped a very important step there composer require See vegans slash composer patches Let's get that There we go and Package we got that we got that Extracting. Okay. So now let's try if I do a composer install There we go. Okay so It saw that there are patches. So basically reinstalls draggable views and then it applies the patch And that's it So if for some reason the patch didn't apply anymore, there'd be a little message saying hey the patch doesn't apply anymore At which point you've got to do the normal things you have to do you come and you come over here And you see if maybe your patch got committed Um, in which case you can remove it from composer patches You see if maybe there's a new version of Of draggable views and the path patch need to be needs to be re-rolled or maybe there's a more up-to-date patch These are all normal Drupal things you would have to do Um, but I mean it's it's dead simple and it really takes a lot of the fear out of Applying patches if you have a patch that's specific to your site, which probably isn't the best thing But you know, we all have to do it every now and then this path does not have to be remote You can basically have a local patch, you know pull it out of your you know patches directory in your project group Um, so there's actually a lot of different ways that you can configure composer patches But this is the by far the one I see used the most often All right, so Ralph has a question is composer patches necessary at all as soon as Drupal issue forks is available From that point on could use the branch and commit locking you presented before. Um Sure Yep, I guess if you want Ralph you can um, you can do it that way Um I don't know if I would have a preference. I'm trying to I no one's asked me that question before um So for me Ralph, I think I would stick to the way I'm doing it right now because the way I'm doing it right now Basically, you start off with something stable and then you're applying one patch So you're limiting the number of variables just to that one patch if you are checking out a different branch That just happens to have The stuff you need you might also be getting other stuff that isn't fully vetted yet If that makes sense So that's like my thinking about it for 30 seconds answer. I think I would probably still stick with this way just because I'm My mentality is like limit the number of variables. You know, you saw it when I was talking about the Uh, the um scaffolding plugin Right, just limit the variables get rid of the the files we don't need so All right, let's move on shall we? Um, so those are two good ones. Um run composer install dependency conflict resolution um Patch breaks and rule Yep, okay. Yeah miles. Good point as well. Thank you So here's something that we all run into every now and then we go to update something and we go to install something You know require something we know exists and we get this message Uh, nothing to install our update and you're like I don't think so composer. I know I know there's something I can install our update You know, why can't I install our update? um So my go-to whenever I see this is why not? And that's actually it's actually an alias to the composer prohibits command, but Why not? I think it just makes a whole lot more sense and a whole lot easier to remember um After you do a composer update a vendor name and you get nothing to install their update Immediately the first thing I do is composer. Why not the vendor name? And so here's like a really simple example of that. All right, and um, like if I try and composer update twig twig All right, so obviously, you know twig is part of drupal core and um, I know for a fact like if I use um composer out dated twig twig This is gonna update it basically shows you that oh, all right, let me just do uh, composer outdated Flash star do it this way Um, yeah, so I'm on two twelve five, but there's a there's a major version update of twig Yeah, I want that I think you know, I act like like I do um, but You know as you saw when I did the you know composer update twig twig No, it's gonna tell me no you can't have it nothing, you know Nothing to install or Composer to the message is a little bit different nothing to install update or remove and you're like I don't think so because I'm on version two and I just saw there's version three So hey composer, why not? Twig twig why can't I update twig twig and it it's gonna tell us It's basically gonna tell us how well first of all you're using this thing which requires, you know Something better than one four one or something better than two twelve But then you're also using drupal core which requires something better than this But you're also, you know using the core recommended This is a meta package and this requires an exact version So here's your answer. Why not we cannot update this because these three things are not allowing us to So again, this is kind of a very dense or maybe not dense not the right word, but this is a you know, a simple example um But it's incredibly useful composer. Why not so use that one um, I use depends every now and then um, composer depends fender name and so like composer what depends on twig Oh, this is going to show similar information, you know as why not actually in this case exact information Let's try composer the pens draggable views and see if anything depends on draggable views. I don't think it's going to Well, how about How about I type Astor than I talk So, you know our project requires draggable views So that's about it All right, so that's another good tool Um, composer outdated. I showed you there's a bunch of variations on composer outdated. I actually use this I'm more often than I go to the available updates page so Yeah What modules are outdated and the nice thing about this is or what droopel dependencies? I should say are outdated The nice thing about this is it doesn't care if the modules are enabled or not So in this case, you know, I don't have anything It's a you know pretty pretty new site. Um, you can do direct dependencies So a direct dependency is one that appears in your composer at jason So something you specifically asked for as opposed to an indirect dependency Which and this is a great demo here because I'm putting in commands that return nothing. So you're welcome for that Um, but an indirect dependency is a dependency that gets installed Because it's a dependency of another dependency Okay, let's try this one. Maybe I can outdated minor only New site. So I don't think we're gonna get much of it. Trust me. These commands all work and they're fabulous Um, let's see composer outdated minor only You can get anything here probably not because I just created this site on thursday for the training I did Oh, there we go. Oh, yeah. Okay. Well, these are all indirect ones. So, you know, this is all core stuff It's like, oh, this seems important. Like I should get this update Right because there's looks like it's a it's a maintenance update. So let me try that Composer why not, you know this and you know, guess what the answer is going to be Because core recommended said no core recommended says we're on this version And this is what kind of keeps dribble stable because this is the version Of symphony htp kernel that passed all the tests with Drupal core 9.0.7 So those are some really helpful commands I showed you some of those showed you some of those All right, so when you do a problem whether it's, you know Composer's not letting you do something because of a dependency conflict Start with these two um Then once you're, you know, if you can narrow it down to which dependencies are involved in the conflict One thing that works really well for me and I said better than 50% of the time this solves the problem Is I will remove the involved dependencies And then I will re-require them together. So kind of what I was talking about earlier So Composer remove, you know, the problem children And then try requiring them at the same time And this is a little bit of typo because this should be named one right there and I that's four typos That's four demerits my permanent record someone write that down um But when you do it like this let Composer figure it out let Composer figure out the You know what sub dependency versions we need. So this works for me a lot Another thing you can do. Um, we just kind of, you know thrown up Throne up your hands Delete the vendor directories You know and by the vendor directories I also mean like your your modules contrib directory anywhere where your dependencies might end up And then just Composer install re-install the dependencies and sometimes that fixes it Um, and I know a lot of people and someone mentioned earlier um You know deleting that Composer out lock file. I I consider that a Like defeat giving up um, I have not deleted a Composer out lock file and and done a Composer install and Well over a year or possibly on the order of years at this point. Um I kind of take it as a personal challenge when I get a Composer dependency issue To to figure it out And granted I get it, you know if you're up against a deadline or something But at all, you know do what you can to avoid deleting your Composer out lock is once you delete that You're basically committed to updating everything Pretty much unless you go in and pin stuff in your Composer at Jason But but really before you get to step four really really focus on steps one through three and see if you can't solve the problem that way All right, how are we on time 642 I have three minutes is that is that accurate? I think it was Luke was that your name. I'm sorry. I totally forgot Luke. Yeah, Luke is Three minutes. Holy cow. Okay. Well, I really like this part. So maybe we'll go over But feel free to start, you know, you know, if everyone needs a refreshment feel free Let's talk about this content hash file Thank you, Mike, you know as soon as I said it I'm like Someone's gonna comment on that so Let's talk about inside of the Composer out lock file There is a content hash and there oops. There's a lot of stuff in there But if we just do a you know a real quick Pico Composer lock You know, we can talk about this thing. It's right after, you know, four or five lines down this content hash. Let's talk about that um So this it's a value. It's calculated. It's not random Okay, it's not You know, it's a calculated hash like like a get hash something like that and it's calculated by the contents of The Composer.json name the require require dev sections extra section as well as some other parts So if you manually or or or if you manually change any of these sections or you Composer require something that that ends up being a change in this Then you're going to get a new content hash All right, so that's thing one It's calculated Based on a bunch of stuff inside of your Composer.json file So consider the situation, you know, you add a new dependency Composer require blah blah blah You get a new content hash Let's say you've got to get branches On branch one you've added a dependency So you get a new content hash on branch two. You've added a different dependency So now you have a different content hash What happens when you go to rebase or merge? Branch one and branch two together Which one of these Correct Answer is neither Neither Once you merge you're basically taking the dependency from branch one and the dependency from branch two putting them into one branch Composer does its thing and there's going to be a new content hash. That's not this or not this So you will always Have a code conflict in your Composer.lock When merging or rebasing Divergent branches How do you solve it? Once you kind of understand what's going on it actually becomes a lot easier So as an example, you know, I'm just going to merge in this case or do a you know talk about merging I'm actually going to do it If you're on branch one And you want to merge branch two into branch one you call your git merge On you know branch two you're going to get your conflict Composer.lock every time guaranteed. I promise So what do you do? Well, first you just pick one You know you check you want to get you know, you can even go in there manually and get rid of all the little Git conflict markers and all that stuff But just pick one so either pick hours or theirs In this case since we're merging hours is actually the version of Composer.lock. That's in branch one So so you check it out And then do a Composer update dash dash lock Now this doesn't actually update any of your dependencies All it does is update your lock file Most importantly it calculates a new content hash So that's important because now you're going to get a new content hash that includes both dependencies So that updates the lock file. So you do your git add to mark it as Resolved what's the right word? It's not resolved mark it as Unconflicted whatever the git word is and then finish your commit Works pretty much the same way when rebasing, you know check one out Update and then git rebase dash dash continue so This is one again Embarrassingly probably took me three years before I really understood it And again, you know, it took me just saying you know what I'm gonna, you know, I'm gonna figure out what this thing's all about And do it. So there you go All right, let's finish up finish up on a high note. Uh Composer 2.0. It's faster and these numbers are They are conservative right so Tilda 50 percent, you know in most cases it's way more than 50 percent It uses way much way less memory in some cases it uses Like 99 percent less memory. It's crazy how much less memory Which is really going to open the door for Composer 2.0 to be used in a lot more remote hosting environments, I think It is officially compatible with the composer with the Drupal core Composer plugins the scaffolding one in the core project message And it is compatible with many composer plugins that are used in Drupal projects Semi-officially Composer 1 and Composer 2 can be used on the same project at the same time And by semi-officially Hussein Abbas, I don't know if Hussein's here. He seems like he's always I see him a lot in my composer section. He's kind of like my composer wingman on my sessions And I haven't seen him. So either I've I haven't said anything wrong yet or Hussein isn't here But Hussein found a comment in the composer issue queue from one of the maintainers saying that They should be compatible. So for me, I'm calling that semi-official Um, you can try it. It's dead simple Dead simple to try it Composer self update preview and boom you're on the latest release candidate. You don't like it composer self update dash dash rollback And boom you're on Yep, now I'm back on 1.10 Uh, but I want to try it again. So I'm gonna preview and boom I'm on Back on 2. I think the rc2 is what's out. Yeah rc2. So so dead simple dead simple Um, composer plugins often by use by Drupal developers the the recommended project plugins I just mentioned those are composer 2 compatible Composer patches as of a week or two ago version 1.7. So you might have to composer update Composer patches, but that is now working with composer 2. Yay Um, I use this one as well the composer installer extenders. This lets you manage javascripty dependencies with composer And you you kind of need this dependency and this is not compatible One that I use that is not yet compatible is this composer cleanup vcs directories So if you are if you have to commit your dependencies to your repo This this plugin will automatically delete those dot get directories Doesn't look like there's a whole lot of momentum towards making this composer 2 compatible yet I'm hoping it will just magically happen and Um Yeah So these are the ones I see a lot. Well, I see the prestissimo high rack slash Prestissimo composer plugin a lot of people use you don't need that with composer 2. So get rid of it That functionality is built into composer 2 and there's another one. I think it's qs traveler. I always forget what it what it is qs traveler uh Composer Drupal something, but it's basically it's another performance enhancement tool for and again, you don't need that one for composer 2 as well All right, by the way, here I am. This is me. Um, do Drupal for a long time Uh, yeah, okay Any questions in the negative six minutes that we have I don't think I missed anything in the chat if I did please correct me No, you guys are super fantastic. I love it Uh advice for those who have to update Drupal with aqua lightning. I don't use lightning So I don't have a good answer. Uh Are you asking me should you use compose painful Yeah, I'm sorry. I I I don't I I can't speak on that topic I apologize Yeah, I think I I do I do agree with marky there for sure Yeah profiles are you know, I don't know. I'm not a huge fan of uh Install profiles, but that's just me Okay Thank you, Mike. Thank you for keeping me honest As well as always. All right. Well, hey everyone, uh, you know, those of you that I that I had a chance to talk with today at Bad Camp, I appreciate, you know, always good to see everyone. I miss, you know I miss all my Drupal my Drupal friends. So everyone have a great rest of your day no matter where you are and um, Yeah, I'll I'll see everyone around