Liplex
  • PHP
  • Symfony
  • MySQL
  • Git
  • Mac

symfony

A collection of 24 posts

Remove JWT refresh token on logout in Symfony
php

Remove JWT refresh token on logout in Symfony

Using JWT has a few advantages when working with SPAs, but also a few security disadvantages. One of them is that (depending on the implementation) with only a refresh token you can initiate

  • Christian Kolb
    Christian Kolb
1 min read
Cors Listener in Symfony backend
symfony

Cors Listener in Symfony backend

When working with a frontend and backend on different domains I run into issues with the cors headers. Here's a way to solve them for a Symfony backend.A setup might look like

  • Christian Kolb
    Christian Kolb
2 min read
Serialize null as undefined with Symfony serializer
symfony

Serialize null as undefined with Symfony serializer

There are two popular packages when for serialization when working with Symfony or with PHP in general. One serializes null as undefined and one as null. The one serializing it as undefined by

  • Christian Kolb
    Christian Kolb
1 min read
Catch all routing in Symfony
symfony

Catch all routing in Symfony

When building single page applications, I still base them on top of symfony as I want to use the Symfony profiler. The whole routing should still take place in the frontend, so I

  • Christian Kolb
    Christian Kolb
1 min read
Generate a new JWT public and private key
security

Generate a new JWT public and private key

JSON Web Tokens are becoming more and more common in single page applications and I'm also using them in multiple projects. But I also forget how to generate a new token (private and

  • Christian Kolb
    Christian Kolb
1 min read
Create new JWT when user updates email address (username)
symfony

Create new JWT when user updates email address (username)

Using JWT for a single page application in combination with Symfony in the backend is great when using the bundles lexik/jwt-authentication-bundle and gesdinet/jwt-refresh-token-bundle. lexik/jwt-authentication-bundle provides general JWT based authentication. gesdinet/

  • Christian Kolb
    Christian Kolb
3 min read
Symfony http basic auth for debugging on live server
php

Symfony http basic auth for debugging on live server

When deploying a Symfony application you usually remove the dev environment for security reasons. Which of course makes it more difficult to debug the system if there are errors occurring. An easy solution

  • Christian Kolb
    Christian Kolb
2 min read
Get translatable entity from repository with specific locale
symfony

Get translatable entity from repository with specific locale

I wanted to have translatable entities in my project. So I used Gedmo translatable through the doctrine extensions bundle for Symfony. When using any kind of entity repository, a listener automatically pulls the

  • Christian Kolb
    Christian Kolb
1 min read
Use environment variables as Symfony parameters
symfony

Use environment variables as Symfony parameters

I had a case where I wanted to store a configuration into a vhost environment variable. But how to get this into your symfony parameters? There is a special environment variable prefix in

  • Christian Kolb
    Christian Kolb
1 min read
symfony

Disable elements in the Symfony developer toolbar with CompilerPass

One of the comments of the "Disable elements in the Symfony developer toolbar" post was the question to do the same thing with a compiler pass instead of overwriting the definitions

  • Christian Kolb
    Christian Kolb
1 min read
symfony

Disable elements in the Symfony developer toolbar

There are a lot of handy elements in the Symfony toolbar. But I think - especially with the last version - the toolbar got a little bit crowded. There are just a few

  • Christian Kolb
    Christian Kolb
1 min read
symfony

How to pass SensioLabs Insight route check when using SonataAdminBundle

One of the rules SensioLabs Insight checks for is: A route should always have a valid HTTP method This will always fail when you use the SonataAdminBundle, because there is no way to

  • Christian Kolb
    Christian Kolb
2 min read
php

Add Access-Control-Allow-Origin

Cross-site HTTP requests are HTTP requests for resources from a different domain than the domain of the resource making the request. For instance, a resource loaded from Domain A (http://www.liplex.de)

  • Christian Kolb
    Christian Kolb
1 min read
mysql

Symfony console connection refused with MAMP

Recently I switched from a custom system setup on my Mac (Apache, MySQL, PHP, ...) to the MAMP Pro system. Unfortunately the Symfony console won't work with the default configuration in parameters.yml like

  • Christian Kolb
    Christian Kolb
1 min read
symfony

Symfony installer

I recently stumbled over a "new" tool in the Symfony environment called the Symfony installer. It's a simple little tool which help you to start a new project based on the

  • Christian Kolb
    Christian Kolb
1 min read
symfony

Get data from json request with Symfony

When working with Symfony actions you can get request parameters with $request->get('parameter-name'). When working with JSON requests, you don't have this kind of convenience methods. You're going to need to

  • Christian Kolb
    Christian Kolb
1 min read
symfony

Symfony route to annotation

When setting up routes with yml, xml or php you always define a name for a route. This name can be used to generate a url. With annotations this name is not required

  • Christian Kolb
    Christian Kolb
1 min read
symfony

"IS NOT NULL" expression with Symfony query builder

I searched for a easy way to get values that contain a not null in the where clause. That's what I came up with: $repo = $this->getDoctrine()->getRepository('LiplexBundle:User')

  • Christian Kolb
    Christian Kolb
1 min read
best-practices

Generate parameters.yml files in Symfony

The best practice in Symfony with the parameters.yml file is to create a parameters.yml.dist file and generate the parameters.yml from it. But how do you do this? With the

  • Christian Kolb
    Christian Kolb
1 min read
php

Redirect user to login page on access denied in symfony

Add the following line to your security config(app/config/security.yml) security: access_denied_url: /login

  • Christian Kolb
    Christian Kolb
1 min read
php

Symfony services with autocomplete in IDE

I use PhpStorm as my IDE for PHP development. It has a nice framework integration for Symfony but lacks the autocomplete when you get services through the container: $mailChimpService = $this->get('hype_

  • Christian Kolb
    Christian Kolb
1 min read
uberspace

Getting a symfony project running on uberspace

I really like the german hoster uberspace. They have a great setup, awesome documentation (only in german) and an amazing support team. This is a small introduction how you get your symfony project

  • Christian Kolb
    Christian Kolb
1 min read
analysis

Symfony code analysis done right

Everyone working with symfony should know the company SensioLabs. It’s the geniuses behind symfony and they are innovating like crazy. There newest (and for me most amazing) product is called SensioLabsInsight. It’

  • Christian Kolb
    Christian Kolb
1 min read
homebrew

Setup a development environment for Symfony on a Mac with Homebrew

Althougha Mac already comes with an apache and php installed, as soon as you’re starting serious development, you’re going to miss a few things. There are many package manager out there

  • Christian Kolb
    Christian Kolb
2 min read
Liplex © 2019
Latest Posts Datenschutz Impressum