Creating a Web App with Symfony 4: Entity Services

This is a continuation from the previous post. If you haven’t read it yet, click here! Now that we have our entities, we need to make some services that can handle managing them, similar to the UserService we have already. Since these entity services are going to mostly be doing the same thing (creating, validating and saving), we’re going to make a base class that handles that functionality. Then we’ll extend the base class for the individual entity services so there isn’t a ton of code duplication. So let’s get started! In the src/Service/Entity folder, create a new file called

Continue reading

Creating a Web App with Symfony 4: Doctrine Entities

In this tutorial we’re going to start building a resume builder web app. We’ll be building off of the code that we wrote in the previous tutorials. If you haven’t been following along and want to get a head start, you can download the starting code here. Though it’s recommended to start from the beginning if your completely new to Symfony. We’ll be using everything we learned in the previous tutorials to make this web app happen. First we will update our User entity to include some extra details that normally appear on a resume, like address, phone and name,

Continue reading

Working with Services in Symfony 4

In Symfony, Service classes generally are used to hold code that performs repeatable tasks. For example, say you needed to format a phone number. You would make a service class with a method that formats the phone number as opposed to copying and pasting the same bit of code around each time you needed to format a phone number. Services are also a good place to store your business logic code. Code that doesn’t really belong in your controller, entity or repository classes. So far we’ve built out an API which lets a user register, login and see their account

Continue reading

Building a JWT Authenticator in Symfony 4

This tutorial is a continuation of last week’s post on creating a backend API with Symfony. Today we will be implementing authentication with a JWT. JWT stands for JSON Web Token. In practice, a JWT is generally used as a way of storing the user’s session off of the server. That way, your API can stay stateless. If you followed along from the last tutorial, currently after we login, the session is stored on the server. That’s perfectly fine to do, and it’s how a lot of websites store sessions. However, by making your API stateless you remove the extra

Continue reading

Backend API Authentication with Symfony 4

This will be the first of a series of posts where you will learn how to create a full blown web app from scratch with Symfony 4 and VueJS. In today’s post we will go over setting up your environment and creating the registration, login and logout endpoints. Before we begin this tutorial, there are some prerequisites: You should be comfortable with PHP You should have access to a web server that supports PHP 7.2 and MySQL 5.7 You need to have composer installed on your server You will need Postman or some way to make requests to the API

Continue reading

How to come up with project ideas

Are you tired of building the same todo app every time you go to learn a new language or build on the skills you already have? If you are, hopefully these tips will help you in figuring out how to come up with project ideas. Tip #1 Don’t think so hard about it. You do not need to build something huge, and in fact it doesn’t even need to be a complete project. Your project can be as simple as a login form. The biggest thing is that you learn from it. Tip #2 Do you suck at design? Me

Continue reading