hey everyone it's dan here from pixelfix and welcome to my channel
this episode is part of my laravel 9 api development course and in this course we
will cover the most frequently used features of laravel with regards to api development we will
also cover some more advanced features which might not be so frequently used but it will be good to
know how and when to use them and as always if you like this video please give it a thumbs up
and please remember to click the subscribe button and hit that notifications icon in this episode
we will start off by doing the simple stuff like installing laravel from scratch installing some
dependency packages we will use during the course as well as setting up our testing environment
all right so let's jump straight in and head over to the laddervale website
if you click on get started it'll take you to the installation instructions and the one we're
looking for is the installation via composer so if you click on that link you'll see it'll take
you to the instructions for composer what we'll do is we'll just copy this command
and then head over to our terminal now wherever you want to create your project
it's totally up to you i've created a projects folder on my c drive and i'm
going to install this inside my projects folder so i'll just paste in that command
and start the installation now this process could take a few minutes depending on your system
so what i'll do is i'll just pause the video here and come back when it's finished
all right so now that it's finished let's let's navigate into that folder
and open it in vs code all right so once vs code is open we'll start by hooking up our database and
we do so by going to the env file and within the database section which is this section over here
we add our database name the username and the password so i've already set up a database
called lot of our api and with the username of a lot of our api and the password of
password now in order to test this we need to run our migrations now a migration
is a term or a file that you use within laravel in order to set up your tables via a command line
and we do so by calling the php artisan migrate command so once this command has completed and
you don't have any errors on your screen you can safely assume that your database has been set up
correctly you also see there are four migrations that's that has been run now these migrations
are things that laravel provides you out of the box and we won't cover them in this episode but
we will go into further detail in future episodes so next we want to set up our testing environment
and laravel makes it really really easy because it provides excellent integration with php unit
which is one of the most popular if not the most popular testing framework for php out there all
right so what we want to do is in our phpunit.xml file which is the basically the configuration file
for our testing environment is uncomment these two lines now the first line the db connection
just specifies the type of database you want to use for your testing now the second line which is
the database you specify the in-memory database meaning that you won't use a physical database
on your machine but actually just one in the memory which greatly improves performance okay
now that our config file has been saved we'll navigate to the test folder on the left you'll
see that laravel provides a couple of tests out of the box but this is basically just to check that
your application has been set up correctly and we can do so by running the php unit command you'll
see two tests run two assertions has been done and everything is green it means that your application
has been set up correctly we can also confirm this by running the php application on the local php
server which is done by running php artisan serve and you can then navigate to localhostport8000
to confirm that your application has been set up correctly all right that's it for this first
episode so just to recap we've covered the installation via composer we've connected
the mysql database and ran the migrations we set up the testing environment using phpunit
and confirmed the application was set up correctly in the next episode we will cover aspects
relating to user account creation registration as well as login functionality using jwt tokens
and cookies so please stay tuned thank you so much for watching i really hope this was informative
and if you liked this episode please give it a thumbs up and remember to subscribe this will
help out a lot in order for me to bring you more content thanks everyone see you later