symfony posts

Upgraded Symfony 4.4 to 5.4

I’ve upgraded my website to Symfony 5.4 from 4.4. I’ve continued on without Symfony Flex, as I had when updating from 3.4 to 4.4. The procedure was fairly similar to that, fixing any Symfony 4 deprecations and then updating the composer version constraints, fixing anything broken after that. I also switched from requiring the symfony/symfony repo to requiring individual components. It went fairly smoothly, aside from needing to fix a few things after the composer update.

Continue reading post "Upgraded Symfony 4.4 to 5.4"

Ansible, Vagrant, and Symfony `var` permissions

I have moved to using VirtualBox VM’s for my local web development. I use Vagrant and Ansible to set them up. For my site, I use synced folders to share the site files from the local machine to the dev VM. This limits what permissions can be set on the files though, and doesn’t work well for Symfony’s var folder stuff, eg cache and logs. The normal Symfony permissions for those folders use ACL’s, but those cannot be set on Vagrant synced files. My solution was to create a /var/www/var folder to store such folders for any sites on the VM, and symlink them into place in the shared folder location. I did this with Ansible so that it would be reproducible. Since I ran into some issues getting it working, I thought I’d blog about it.

Continue reading post "Ansible, Vagrant, and Symfony `var` permissions"

Up way later than I wanted to be, fighting with Symfony’s framework bundle trapping PHP errors from getting to my Apache logs, and Apache’s ErrorLogFormat not being able to display REQUEST_URI. Gonna have to come back to these later.


Symfony console: Freeing up default short options

I like Symfony’s console component, and use it for much of my command line scripting these days. One thing I dislike is that it takes use of some short option characters for itself. The built in handling of verbosity with -v is nice and is fairly common in the CLI world, but some, like -h and -n, are more varied in use and would be desirable to have for various purposes in my own commands. I decided to remove these defaults in my own console app recently, and will describe how to do so.

Continue reading post "Symfony console: Freeing up default short options"

Symfony router: check for match on different host

I found myself wanting to check if a given URL path exists on another host of a multi-host Symfony application from within a controller action. The router service, which is the instance of Symfony’s routing component used to route requests to actions, has a match() method, but it only accepts the path part of the URL. It also has a matchRequest() method, but that seems to ignore the HTTP_HOST and SERVER_NAME of the passed Request object.

Continue reading post "Symfony router: check for match on different host"