Tag: php

  • How to add a fulltext index in Doctrine with Symfony 5+

    I had to google to find this answer on Stackexchange because I can’t find anything in the docs. Apparently this is something new so you don’t have to jump through the old circus hoops of the past. Apparently you can add a flags section like this to one of the index definitions of your Entity […]

  • Symfony 5+ how to view dump output with AJAX requests

    Symfony 5+ how to view dump output with AJAX requests

    So the idea is to be able to use the Symfony VarDumper component to be able to dump values when sending an AJAX request and view them for debugging while in development mode, but not in production mode. Create a new directory To do this you will need to create an event subscriber and listen […]

  • How to set application values for easy reuse in Symfony 5+

    How to set application values for easy reuse in Symfony 5+

    This article is a work in progress and will be further updated much more in the future. I don’t feel it is complete yet, I’d like to cover more details, more screenshots etc.. So how do you set/configure a value like an upload directory in one location in Symfony so that you can easily use […]

  • Symfony Messenger vs EventDispatcher learn more

    Symfony Messenger vs EventDispatcher learn more

    So maybe you are looking into how to use Symfony in a more Event Driven way. Or maybe you want to speed up your apps response time to users. Or maybe the article title sounds interesting so you are reading this. Under the hood Symfony has something called an EventDispatcher system. You can see this […]

  • How does Symfony decide what content type to return in a response?

    How does Symfony decide what content type to return in a response?

    This isn’t a real article it is a link to an article that explains this process. This way I can find this information again later when I need it and also google can find this question for others in the future and they can find the Symfony cast with the info they need.  And…. this […]

  • Why can only Symfony controller methods be auto-wired and not other services methods?

    Why can only Symfony controller methods be auto-wired and not other services methods?

    So when I first encountered this issue with Symfony I was baffled.  Why can you auto-wire Symfony Controller methods but with Services (aka your other classes under src) why do you have to auto-wire only the constructor. I couldn’t figure out why I couldn’t auto-wire to the methods instead. Well, while working on deciding how […]

  • Symfony 5+ error logging handlers explained

    Symfony 5+ error logging handlers explained

    This will be a super long article, this subject is way more complex than it originally sounds. As always, I’ll be updating this soon with more info and possibly more examples as I figure it out better. First off, you are not limited to just one logger in Symfony. However, the most popular is Monolog […]

  • 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 […]

  • 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 […]