Category: Web Development

  • PHP Enumeration classes vs fake enumerations what to use.

    PHP Enumeration classes vs fake enumerations what to use.

    I am growing to HATE PHP ENUMS. Why? Because if you forget to call ->value you get BS errors about cannot convert object to string. It is just another un-needed step. Enums sounded cool at first but fuq the BS with calling ->value, it is entirely too easy to forget. Enumeration classes in PHP are […]

  • Javascript and contenteditable how to move the cursor to the end of user input

    Javascript and contenteditable how to move the cursor to the end of user input

    This appears to work in all browsers. Let me know if you find issues. So this is something I needed to do and all the examples I found didn’t work properly. Or they worked partially, or only in one browser. The idea seems super simple, but in reality the problem becomes complex for several reasons. […]

  • Javascript event listeners be careful where you bind this

    Javascript event listeners be careful where you bind this

    In Javascript User interface programming you often need to work with EventListeners. In modern Javascript you may also be doing this in a class, which is handy. One of the  things that sucks about Javascript event listeners is they eat memory and slow your app down, if you are not REALLY careful. They do this […]

  • How to view Symfony 5+ FosJsRoutingBundle routes

    How to view Symfony 5+ FosJsRoutingBundle routes

    I can never remember this command. However, now that I am creating more AJAX and exposing endpoints I need this command more often. This command is found in the docs too. But I can never remember where, so I will write about it here. The command to view how FosJsRoutingBundle views your routes. php bin/console […]

  • How to view Symfony routes

    I often need to view my current routes and how the Symfony kernel views them. This usually happens when I am adding new routes, I end up getting conflicts and have to resolve them by viewing what exists etc. The command to view your routes is really simple. Open your console and navigate to your […]

  • Symfony how to get query string values sent by AJAX calls

    Symfony how to get query string values sent by AJAX calls

    When using a Symfony API endpoint for getting values such as maybe something like an auto-complete feature you will need to be able to send some text(what the user enters) to the backend. Then have the backend return a response based on that. For example with an auto complete feature, you might want to send […]

  • How to quickly create a Symfony 5+ controller

    A Symfony 5 controller is just a class. You could just use your IDE to create a new class  for you, but you would need  to add some boiler plate code like the namespace and then extend AbstractController and add some use statements etc. Symfony 5+ has a better way though. With just one command […]

  • Faking Enumerations with Vanilla javascript

    Faking Enumerations with Vanilla javascript

    What is an Enumeration? An Enumeration is a way to create a limited list of options to choose from.This is useful for keeping a list of field names for a form so you can use javascript to animate something for example. Having a limited list of options is helpful so that you can eliminate bugs […]

  • Php Backed Enums don’t forget to call value

    Php Backed Enums don’t forget to call value

    The one thing I don’t like about new PHP enums is, if you forget to call ->value you get exceptions “object can’t be converted to string” It is entirely too easy to forget to call ->value. This means in places where I refactor code I have to remember to call ->value. Hence the article title […]

  • Working with your apps local image assets in Symfony 5+

    Working with your apps local image assets in Symfony 5+

    This article is mostly about managing your apps personal images and SVG files that it uses in your User Interface. It also explains how the Assets system works to the best of my abilities and discoveries. This is the best info about assets, I have found in the docs about assets. It doesn’t mention some […]