 Hey everybody, it's Brian, and we're going to begin learning Yee 2.0. First off, Yee is a framework. It's a PHP framework, and if you Google frameworks, you will see that there are a bajillion frameworks out there. Why would you want a framework? Why wouldn't you just write your own code? I hear that from people all the time. I don't need a framework. I'll write my own code. Well, it's because you'll start writing code to talk to a database, then you'll start writing code to present the information to the user, and then you'll start writing code to let the user modify the information. Essentially, what you're doing is building your own framework. You're reinventing the wheel. So it's just smarter to use a framework that already exists. It's already been tested. It's already been debugged, and it just works. The problem is there's billions of frameworks out there, and each one of them is different. Like Zen framework is really used on a more professional level, but I've heard good things about Larevel, if I'm saying that right, and Coding Knight. Symphony I've heard is pretty good. I haven't heard much about those others, but I actually prefer Yee. I actually went out and did a one-hour walkthrough on each framework, and Yee's the one that really stuck with me. Why? I don't know. It's just personal preference. Everybody's going to have their own preference, so Yee may not be for you. The typical web lifecycle, the user makes a request. The request goes to a server. Server goes to the database, which then builds the web page and sends it back to the client. This is web server 101. I'm just making sure everybody understands the lifecycle. Making the assumption that everybody watching this video understands that whole process, and you know the foundations of PHP enough to make basic web pages, and you're really looking to move more advanced stuff. Yee is a model view controller framework. Now what does that mean? It's an MVC pattern, which almost every popular website out there uses, and for good reason it's very efficient. When the request comes in, the controller, as it is, controls the flow of data. The controller will take the request and analyze it and say, okay, well, I need information from, say, a database. So it grabs a model. Now the model is not a database. It's a representation of the data. The data could be in a database, in an XML file, or just in memory. This depends. So the controller will talk to the model or representation of the data and say, fetch me data. I need this. Or it'll create the data depending on what the request is. The model hands the information back to the controller who says, now that I have data, I need to render a view. So it takes a template called a view and plugs the information from the model into the view. It takes that rendered view and sends it back to the client as the rendered response. So that's the MVC pattern in a nutshell. Congratulations. I just saved you two days of sitting in a computer class listening to theory about MVC patterns. It's really just that simple. Request comes in, talks to the controller who gets a representation of the data, bam, bam, right up to the user. It's that simple. So if you go to Yee Framework, you'll see that it's fast, scalable, and professional. Yee stands for an acronym of yes it is. Is it fast? Yes it is. Is it secure? Yes it is. Well, you get the point. There's a little caveat you should understand right off the bat is there's two distinct versions of Yee. If you go to downloads, you'll see Yee 2.0 and Yee 1.1. Don't be fooled into thinking that 2.0 is just an upgrade from 1.1. They are two totally different frameworks. They worked on Yee and they got to 1.1 and they said, you know guys, this really isn't what we wanted it to be. It doesn't really follow the Yee vision, if you will. So they said, all right, we're going to leave 1.1 up for legacy, you know, in case you've got a website out there and you need the code base. But we're going to scrap everything and start over. So Yee 2.0 is a complete rewrite of the Yee Framework. Oh, yeah, that's a lot to digest, especially if you're like me and you spent a lot of time learning Yee 1.1. 2.0, I actually like it a lot better than 1.1. It's a lot more flexible and it just, once you get it, it just clicks. Now to install 2.0, it's a little tricky. You got to use something called Composer. I don't say you got to. You can actually download the tar GZ and then install it yourself, but it's such a pain I wouldn't recommend it at all. So we'll use something called Composer and I had no idea what Composer was until I actually went to install Yee and I had to read up on it. And if you have no idea what it is, we'll actually talk about it. You can just click here and there's the directions on how to install Composer. I'm not going to get into how to install Composer because, well, it's a little bit beyond the scope and it's just dirt simple. Basically on Linux, I had to install CRL and then I just ran that command and then you just follow the directions and it just runs. You'll know when it's installed because you can go to a command line and type Composer and you get the Composer command line. Now on Windows, it's a little bit different but the instructions are there and it's pretty simple. You literally just call PHP and then read file and then you set it up as a bat so that you can run it and then it just works. So why do you need Composer? I mean, this is a tutorial about Yee. What is Composer? I kind of grumbled and said, I don't want to mess with this Composer stuff until I started really reading about Composer. If you click on Browse Packages and then let's say Image, you see there's, well, of course my cat wants to talk to me while I'm recording. Hi, kitty. You'll see there's 96 pages about images ranging from how to resize an image, how to convert a PDF to an image, how to validate an image, et cetera, et cetera. I mean, just so much code and it's all in PHP. Now this is ready to use code that's already been tested that you can plug right into your web app. Makes it very easy. And you can install all this by, you guessed it, Composer. Kitty, you're winding and you're going to make me sneeze and everybody's going to hear you purr, go away. You should be embarrassed, kitty. Now there's a cat here floating around. All right, so let's bring up my var, dub, dub, dub, HTML. This is where I, hi kitty, just jumped up on top of me. Get down. Daddy's recording. God, this cat, I swear, he's starved for attention. So here's my directory and we're going to actually run this. Now you should note that the directions on the website don't work for me. They say type in phpcomposer.phr and then all this stuff. If I do that, I get an error message. But if I just type Composer and then the command, it works fine. So just know that your method may or may not work the way mine does. So the first thing you want to do is do the global require. So let me actually go into, make sure I actually did that right. Yep, eh, I cannot type. And you'll see how Composer will sit there and churn away in the background and make sure that all the dependencies are updated. And maybe I shouldn't have done that, but we'll let it run. There we go. Nothing to install or update because I've already done it. Now if you skip that step and you just jump ahead and make a website, your website's not going to work. You need to have that. That's a prerequisite for ye. Now you should note there's two installations here. One for basic and one for advanced. Basic as well, if you guessed it, basic. This is your website, this is your store's website, this is your own little search engine, you know. And when I say basic, you can actually build some pretty advanced websites with this thing. Now if you go with advanced, well, it's exactly what it sounds like. It's advanced. This would be like your amazon.com or your walmart.com. These are massive websites that will have front-ends and back-ends and multiple teams working on them. We're going to cover primarily the basic site because, well, we're at the basic level in this tutorial series. So we're going to grab this. We're going to make sure we're in the correct directory because this was, you know, very directory dependent. And we're going to say composer. And it's going to churn away. And in the background, what it's doing right now is it's installing ye via composer. And it's installing all the prerequisites and doing what it needs to do in the background here. Let me actually move this over so we can see. And hopefully this doesn't take too long or I'll just pause the video. So while that's churning away, let's see, yeah, it's actually created the basic folder. Now this is different in the sense that ye1.1 will create what's called a ye route. And then you have your website off to the side where ye2.0 will create a folder and put everything in the folder. Oh, okay, good, it's done. You see how it's done its change mode, change mode, et cetera, et cetera, so we're done here. Now the basic structure of ye website, this is essentially what it looks like. And I'm going to bring it up in NetBeans. Whoopsie, I've got some code up here. Let me close that. This is like my third take at this video because things just keep going horribly wrong like the cat interrupted me, like the little monster that he is. All right, so this is our basic website. Now I'm using NetBeans, but you can use pretty much any editor. This is the folder structure of a ye2 website. You see how you've got assets, commands, et cetera, et cetera. We're just going to drill through some of these assets. Well, you really won't need to mess with this too much. This uses what's called a bootstrap, which tells you where it needs to go and what it needs to look for. Commands, these would be like your cron jobs. If you don't know what that is, it's basically like a command you make the web server run in the background. Like if you want to make a command that goes through the database and gets rid of all users' accounts who haven't registered after 30 days, that's what it would be. Config, this is kind of the first thing we're going to mess with in future tutorials. This is the configuration. So like DB, that's your database configuration. We'll have to actually set up a database and get it talking with ye. Prams, these are parameters that you see. There's an admin and email. And web, this is your basic parameters for your website. Like you've got your cookie validator, your cache, and you notice how just about everything's in array. If you don't know arrays, you're going to have to stop this video, go find an array tutorial I have one out on my site and learn arrays, breathe arrays, live arrays, because everything you need is pretty much an array. And once you start working with it, you'll understand how much easier it is. Now controllers, see how we already have a pre-generated controller called site controller. The controller is, you guessed it, where the request actually goes. And we'll talk about all this in depth when we get to the controller tutorial. But right now, just understand the concept of a controller is just where the request initially goes and then it controls the flow of information. For example, here's action index. This is index.php. So that's where you would be going. It's not entirely accurate. I'll explain more in the future tutorial, but just for concept, that's what it does. Mail, right out of the box, you can send emails and it can send them in HTML format and it gives you a nice beautiful little template as an example of how to send it. Models, remember a model is the representation of the data. We've got a few models in here right now, a contract form because the website has a contact page which will display in a future tutorial. And you can also make a model off of a database. So you can make a representation of the database. So you can fill in a class and then say save and it'll persist everything to the database and it handles all the SQL code for you. So you don't have to pound out all the SQL code. And then there's a user class and this is really what's called an identity interface. This is how the user logs in and logs out of the website. We're going to cover that in depth in future tutorials. Runtime, you don't need a whole lot. There'll be like debug logs and things like that in there. Test, yes, with codeception because yes, you do do unit testing, don't you? If you don't, you should. Vendors, this is where Composer really shines. This is why you need Composer because, well, as you saw, Yee was actually installed via Composer. All these other things are installed via Composer. So if you're building a website and say, you know, shoot, I need to resize an image dynamically as it's coming in on a form post, well, there's a class for that out in Composer and it's literally one command and poof, it's installed. It's pretty awesome. Views, remember, these are the templates that get rendered out to the end user. Pretty basic at this point because we're looking at the basic site. But you can see how here's our template and in there we're making a form field and we're using the data from the model. Remember the model view controller pattern. And then web. This is the actual guts of the website. Well, that was a lot of talking. That was a lot to absorb. In future tutorials, we're going to really key in on how to build things. So if you found any of this helpful or informative, be sure to visit my website, voidrumbs.com. Gosh, I got to take that picture down. My website actually moved like a year and a half ago. I just never took this picture down because I'm a big Darth Vader fan. But if you click on contact, avoid that sexy, sexy picture. That bald guy is me. If you have questions, comments, concerns, be sure I haven't even emboiled. Visit the voidrumbs Facebook group. There's about 300 of us out there in a group on Facebook called voidrumbs. And we're all about just answering questions. So if you contact me, it's going to sit in my inbox for three months until I can get to it. If you go to the voidrumbs Facebook group, you'll probably get an answer in about 10 minutes because there's literally people that sit on there and just love to answer questions. Alright, that's it. Thank you for watching. I hope you found this educational and entertaining.