پی اچ پی

متخصص PHP

The PHP Practitioner

We all start somewhere. When it comes to web development with PHP, well, your first stop is this series. Designed specifically and exclusively for beginners, here, you'll learn the fundamentals of PHP - all the way down to defining variables and arrays.

If you feel somewhat unprepared for the content at Laracasts, this "PHP for beginners" series should be your next stop. New lessons are published every Thursday, so don't fall behind!

سطح مبتدی 25 جلسه آموزشی 04:46:00 ساعت
قسمت 1

Step 1: Get PHP Installed

So you've decided to become a web developer? Excellent, excellent choice. At this point, you have a basic understanding of HTML and CSS, and are now ready to take the next step. Right? Great! Let's learn PHP from the ground up. Step 1 Homework: G...

قسمت 2

Step 2: Install a Proper Code Editor

Before we get started, let's ensure that you have a proper code editor installed on your machine. As you'll find, code editors are much like fashion: everyone has their own preference. It doesn't matter which you choose, so pick one! Step 2 Homewo...

قسمت 3

Step 3: Variables

Now that you're ready to begin coding, let's start at the top. What exactly is a variable, and why would you ever use or need one? Step 3 Homework: Create a variable, and figure out how to echo it onto the screen or page.

قسمت 4

Step 4: PHP and HTML

PHP is a language built for the web. As such, it mixes with regular HTML beautifully. Let's learn how that all works in this episode. You'll review embedding PHP in HTML, calling your first function, and fetching URL parameters. Step 4 Homework: E...

قسمت 5

Step 5: Separate PHP Logic From Presentation

We'll touch on a slightly higher level topic in this episode, but only lightly. If you stick with it long enough, you'll begin to hear the phrase "separation of concerns." At our current skill level, this means we should give consideration to the fac...

قسمت 6

Step 6: Understanding Arrays

Let's learn about a new construct: arrays. Think of them as primitive collections of related data. Maybe you have an array of names, or animals, or practically anything. Even better, we can filter through this data and act upon it with ease. Step...

قسمت 7

Step 7: Associative Arrays

We've learned about basic arrays, but you may also creative associative arrays when necessary. The only difference is that each value within the array is associated with a key. Let me show you. Homework: Create an associative array for a task. This...

قسمت 8

Step 8: Booleans

"Boolean" is a scary, but simple term to understand. It's a data type that represents one of two values: true or false. As you'll find, you'll reference booleans constantly within your projects. So it's important that you understand this one.

قسمت 9

Step 9: Conditionals

A conditional is how we branch our logic into different paths. "If some value is true, then we want to proceed in this way. Otherwise, let's handle it in that way." As you can see, booleans and conditionals go hand-in-hand. Homework: Continue tinke...

قسمت 10

Step 10: Functions

Think of a function as a container for reusable pieces of logic. In this lesson, you'll create your very first function. Homework: Write a function that determines if a provided age (sent through as an argument) is old enough to enter a 21-and-up ni...

قسمت 11

MySQL 101

You've only just begun learning the fundamentals of PHP, and already I'm throwing something else at you. Sorry (bows head in shame), that's just how it is; there are lots of moving pieces to your typical web application. We must take some to review d...

قسمت 12

Classes 101

I know you're excited about MySQL, and want to fetch records using PHP. However, we need to make one quick pit stop. We must learn the basics of writing classes, and creating objects. So let's tackle that in this episode, and then I promise we'll mov...

قسمت 13

Intro to PDO

Now that you understand what a class is, we can get back to fetching your first results from the database. To do so, we'll leverage PHP's PDO library, and create a prepared statement.

قسمت 14

PDO Refactoring and Collaborators

In this episode, you'll perform your first refactor. "Refactor" is a term we use to describe the process of changing the structure of your code, without affecting the underlying behavior. I'll be pushing your limits a bit in this episode, so you may...

قسمت 15

Hide Your Secret Passwords

At the moment, we're hardcoding our database username and password directly within the Connection class. But, we don't really want to do this. It's too dangerous. Instead, let's extract any secret passwords or keys for our app into its own file, and...

قسمت 16

Make a Router

Let's discuss routing in this episode. While, yes, you can create PHP files that correspond to the URI, this breaks down pretty quickly. So instead, we'll make a very basic router. This allows us to associate any URI endpoint with a controller. View...

قسمت 17

Dry Up Your Views

Let's take some time to work on our views. At the moment, we've been rewriting the entire wrapping HTML for every single page. Naturally, this breaks down very quickly in real life. Each time you update, say, your navigation area, you'd need to open...

قسمت 18

Array Filtering

PHP's various array functions are tools that absolutely need to rest in your belt. While the good ole'foreach can usually get the job done, more often than not, there's a better way. In this episode, I'll introduce you to array_filter, array_map, and...

قسمت 19

Forms, Request Types, and Routing

Let's transition over to working with forms. If we want a form's submission to POST to a particular endpoint, well, our router isn't yet set up to handle that. How exactly might we associate a URI with the request type (GET, POST) that it should resp...

قسمت 20

Dynamic Inserts With PDO

So far, we've only written the logic to fetch records from the database. But now it seems that we need to, not only insert new records, but do so dynamically. It sounds like we'll need to update our QueryBuilder class to allow for this. View the s...

قسمت 21

Composer Autoloading

No more PHP requires! They're annoying to write, aren't they? Instead, let's take some time to switch over to Composer, which is an industry standard for not just dependency management, but also autoloading.

قسمت 22

Your First DI Container

"Dependency injection Container" sounds like a super scary thing. But it's easy to understand! Think of them as boxes. Apply a label, and throw your stuff into the box. When you need them back, simply look for the corresponding label! In this episode...

قسمت 23

Refactoring to Controller Classes

So far in this series, our "controllers" have simply been plain PHP files. In this episode, however, we'll refactor the router to allow for loading and calling actions on a controller class. I think you'll find that this drastically simplifies our wo...

قسمت 24

Switch to Namespaces

At the moment, all of our classes share the same global namespace. But, think about it: you wouldn't throw your entire music collection into a single folder, and the same is true for your PHP classes. In this lesson, we'll switch over to dedicated na...

قسمت 25

Meet Your Batteries Included Framework: Laravel

It's time for you to meet my framework of choice: Laravel (duh). In this lesson, we'll review the basic folder structure, discuss how it is similar to the custom-built framework from this series, and then review why it's preferred, in this author's o...