For a website to feel modern, the days of click button > entire page refresh > repeat being an acceptable user experience are over. Instead, our users want swanky UI with dynamic updates, load-on-scroll, 'real time' form field validation, and all that jazz.

PHP doesn't seem cut out to offer this. Certainly, with Symfony, this isn't the experience you get right out of the box.

But what if you could get the best of both worlds?

What if you could leverage everything you know about PHP, and still get to use Angular, React, Ionic, or any other modern front end framework?

You'd probably think that this would be, at the very least, quite difficult. In this video series I will show you that this simply isn't the case.

In this video we will cover how quickly we can lay a foundation to use Symfony 3 and Twig to create what you likely think of as a typical PHP web application / website. It's going to be click > refresh page > click > etc.

This is an important first step as it covers how we might currently be doing things.

By the end of this video we will have:

  • added a BlogPost entity to our new Symfony 3 project
  • used Will Durand's Faker Bundle to seed our database
  • created a listAction in our controller to show all our entities (Read)
  • created a table styled with Bootstrap 3 to easily view our Blog Posts

In the next three videos we will see how to add (Create), edit (Update), and remove (Delete) these entities - the 'old fashioned' way - to cover the basics of CRUD.

After this we will need to rethink our approach.

The foundations are largely the same. But we will no longer use Twig to return static HTML.

Instead, we will switch to outputting JSON. This might make things - initially - more confusing. But this step is important.

Once we start creating our RESTful API, we need to switch from CRUD to GET, POST, PUT, and DELETE.

These verbs enable the same functionality as our Twig approach. But this time, we need to provide our own front-end. We will do this firstly with React, and then secondly with Angular 1.5.

We aren't going to be cranking out some scary enterprise behemoth. Instead, we will keep things as simple as possible, aiming to cover the basics.

I have nothing against Laravel, Lumen, or any other suggestions that are frequently recommended when developers ask what framework to use for their REST API. Anything that keeps PHP moving forwards is a good thing, in my opinion.

But I do want to make the case for Symfony as the basis of your API. Why? Because it's an amazing platform to build upon. And it's much easier than it may initially seem.

Hopefully by the end of this series you will agree with me :)

Code For This Episode

Get the code for this episode.

Share This Episode

If you have found this video helpful, please consider sharing. I really appreciate it.


Episodes in this series

# Title Duration
1 Intro with Twig CRUD - List 06:03
2 Twig CRUD - Create 03:25
3 Twig CRUD - Update (Edit) 02:43
4 Twig CRUD - Delete 02:36
5 Simple Symfony 3 RESTful API Setup 05:32
6 API - GET a Single BlogPost 04:51
7 API - GET a Collection of BlogPosts 02:20
8 API - POST to Create New Data 06:30
9 API - PUT and PATCH to Update 04:11
10 API - DELETE 03:34
11 Angular - Setup, Styling, and GET All 09:19
12 Angular - Refactoring 10:23
13 Angular - Create (POST) 06:54
14 Angular - Update (PUT) 08:41
15 Angular - Remove (DELETE) 06:44
16 React - Intro, Setup, and GET all 06:54
17 React - Refactoring 09:14
18 React Router 04:41
19 React - Create (POST) 13:13
20 React - Update (PUT / PATCH) 12:40
21 React - Delete 11:00
22 React - Tidy Up, and Finish 04:14