1 Laravel Installation and Composer

1 Laravel Installation and Composer



hello my name is Jeffrey Way and I am here to teach you lair oh you're gonna love it so we will visit laravel calm and we'll switch to the documentation to figure out how to install it on our machine now of course it goes without saying if you're gonna use laravel it's a PHP framework you need to have some kind of PHP setup installed on your machine I would consider that a basic prerequisite for this series so if you don't know that now you might not be ready for the series yet figure out how to do that figure out the basics the fundamentals of PHP and then you'll be ready for this okay so that being said we will require at least PHP 5.6 and very likely you already have that on your machine you'll see that I will be using PHP 7.1 in this series next laravel depends upon composer now if you're not familiar with composer yeah some people who maybe worked with PHP a long time ago and are then coming back get a little overwhelmed but trust me composer as your best friend it's a basic dependency manager so as you build projects you will want to pull in things such as laravel but even beyond that maybe you want to pull in a testing tool well in the past you would go to a web site find the download link and it would pull down a zip file yeah not overly great you have to manually manage the dependencies and you have to do this for every single thing you require with composer the entire process is streamlined so let's go ahead and download it and here we go so I'm just going to copy this switch over to my terminal and paste it all in okay you'll see that stem loading now but next I will switch to the getting started guide and I'd like this available globally which means anywhere in my system I can reference composer so take a look at the windows guide if you're on Windows but I will be using the Mac and we can see here that all we have to do is move the composer dot far file to our bin directory so let's take a look you'll see that right now composer dot far is in my current directory I'm going to move that to my user local then directory and I will reference it as composer ok let's run that and we're all set so if I open a new tab now and type composer we have it good job now you'll see all of these commands and it can kind of overwhelm you do not worry in reality most PHP developers who use this everyday may be reference a few of these okay so with that installed we can switch back to laravel and we can see that what we have a couple choices we can install a installer tool and this is a simple executable that allows you to do things like this laravel new app and what that's going to do is download a fresh copy of laravel and that's what I prefer however we could also use composer create project for this composer I want to create a project using the laravel slash Clerval github repository and I'm going to name the project blog so you could paste that in and run it however like I said laravel new blog that's really nice to use so let's get that installed on our machine you'll see that we're going to install this through composer but we're gonna make it globally accessible so we add the global flag and you'll find with composer this is generally the shape it will take composer require and then you type in the package that you need and further to research you can visit packages org and we routes around for what you need for example there's a popular tool called carbon which makes the process of working with and formatting dates really easy we can see that right here so yes I can review how to use it on the github repository but I can also run composer require to pull this into my project immediately it's really great anyways now that we've installed it globally you'll see a little note here make sure to place this directory path within our system path so that the laravel executable can be located okay so for your machine this will be a little unique based upon Windows or Mac Windows users just do a quick google search and you'll be all set on the Mac your going to using whatever editor you prefer I'll just use them you will want to either open your bash our C file and I will say export path equals and we'll paste this in however I don't want to overwrite whatever was already in my path my system path so we can use a colon and then use this dollar sign path variable to represent everything else so I'm going to add composers vendor bin directory to my path as well as separated by a colon anything else that I require and that should do it however in my case I happen to use something called the seashell and if you're familiar with that you would put it within your seashell RC file and if we take a look you'll see that I've done that very thing export path equals my standard local bin but then also my composer bin directory and that's it so now if you open a new tab you should be able to tight laravel and you're all set to go let's create a new project laravel new blog you'll see all of these composer dependencies being installed and it's ready so if I CD into the blog and then open this within my editor of choice which is sublime there we go we have a fresh installation of laravel however one final note before we finish up switch back to the terminal and run PHP artisan this is Larry fellows command-line utility and you're gonna see lots of different commands set I'll teach you all about anyhow if we scroll to the top we can see that the – V option will spit out the application version so if I run PHP artisan – avi I'm gonna get five point three point twenty nine at the time of this recording and that's because as I'm preparing this series five point four is exactly one week away from being launched so I'm gonna go back remove the blog and instead to laravel new blog but I will add this death flag this is my way of saying I want to install the development branch and again at the time of this recording the development branch is five point four for you it very well could be five point five so make sure you check what the official release of laravel is as you're watching this let's do it again PHP artisan – V and there we go now I've installed laravel 5.4 and we're all set to go

Leave a Reply

Your email address will not be published. Required fields are marked *