I have got a few messages on my LinkedIn regarding my PHP post the other day so I decided to write a bit about the start of my journey in the world of PHP.
My main motivation for learning this language is -and I'm going to be brutally honest- the job market. Studying Ruby on Rails at Flatiron Bootcamp was amazing, but the job prospects are grim as most of the Rails jobs are for people with a few years of experience, not juniors, but I derail (pun intended).
Okay so as a PHP junior, I've found a few useful resources and tools:
XAMPP is a popular PHP development environment that you can install on all the platforms (Linux, Windows and Mac). If you follow the instructions from here -- click on the video, you should have it up and running in no time.
You just open up the XAMPP after you installed it and click on the start buttons for the Apache and MySQL modules.
This will basically start your server which you'll find by default under the "localhost" address, so just type that in your browser.
You'll want to create your own php files, right? So in order to do that, go to the path 'xampp/htdocs' and create a folder with your project, maybe something cool like "todolist". Todo lists are cool, right? ...right?
Create your php files there and you can access them from your localhost address like this "localhost/todolist/index.php".
Now you just need to know how to write PHP and you're sorted.
I highly recommend this FREE course by Brad Traversy.
It's quite simple to create a database using XAMPP.
Type in your browser search bar 'localhost/phpmyadmin' and you'll see an overwhelming interface, but do not worry! It's not that scary if you actually look at it.
On the right side you can see the magic word "New". You can either press it, or be directed by default to the database panel where you have to enter the database name and just press create.
For this example I've created a table named "posts" that has 4 columns.
The first column is the "id" which you need to make sure it has a type of "INT" (integer) and that it is automatically incremented, by checking the "A_I" checkbox.
The second one is designated for the body of the post (the actual content) with a type of "TEXT" -- no need to give it other attributes.
The third one, author is going to be a type of "VARCHAR" with a length of 255 characters
And the fourth will have a "DATETIME" type that we will give a default value of "CURRENT_TIME".
Press Save and you'll have a lovely table like this:
Of course, you can play around and go to the INSERT tab and populate your database, but going more in depth is out of this article's scope.
This is an amazing tool for testing your API -- if you want to build any. But you should want to build at least an API in your lifetime. It's fun and it's not that hard!