Symfony’s deprecation warnings while running tests is a great service to keep track with upcoming changes in newer symfony versions.
However these warnings can break your CI/CD pipeline and sometimes you cant fix all deprecation warnings immediatly.
To disable them you can set the ENV var
Continue reading “Disable symfony deprecation warnings in PHPUnit tests”
and the warnings will not be displayed anymore and CI/CD will pass again.
Update from comments:
does also work and will still show the deprecation warnings count. (Thx Max)
When working with APIs you sometimes cant use the live API in the tests.
Because you dont own the API, dont want to spam, cant create entities for testing or various other reasons.
Then you need to mock the API and deliever responses from fixtures.
Though there is this term of “Don’t mock what you don’t own” we will mock the API because we dont own it. :)
https://github.com/julienfalque/http-mock is a nice library which helps a lot when mocking an API.
And when your client is using Guzzle there is also a Guzzle handler for HttpMock that makes integration easy.
How does this work?
Continue reading “mocking APIs with Guzzle”
One very cool feature of the Symfony Workflow Component is the ability to export workflows via graphviz.
Did you know you can also directly render those as PDF files?
Continue reading “Symfony Workflow Component: Dump workflows as PDF”
Angular for frontend with symfony delivering the data have become quite a common setup.
When working with this constellation you will sooner or later come across the i18n topic. Most likely you would want to share translations between front- and backend. So that you could keep translations in one single location while using it for frontend templates as well as server-side error messages etc.
One approach would be to store translations in the symfony yml or xml files and deliver those to the frontend via an api endpoint.
Given that front- and backend-code run on the same server, there is an even simpler solution.
Continue reading “Symfony and Angular: shared translations”
Since version 3.1 there is a Cache component with a PSR-6 implementation integrated in Symfony.
So we do not need to add a 3rd party lib as Doctrine Cache anymore when we need caching these days.
Doctrine Cache does the job but by implementing a standard the Symfony Cache seems to have another advantage besides its delievered anyway. So i checked it out.
Documentation is still a bit sparse and the best resource so far is this blogpost:
I wont go into detail on how you use the Cache but rather how you integrate it with Redis, which is my favourite Cache backend.
Continue reading “Symfony Cache Component with SncRedisBundle”
I recently started to do all PHP development with docker, since I was just tired of installing tons of dev libraries on my machine. Most of which i couldn’t even remember what they actually were good for.
When I first tried docker (docker-toolbox for mac) I was really disappointed how slow symfony apps ran inside the container. Continue reading “Symfony development with docker on a mac”
Symfony’s ParamConverter is a common way to transform some GET param to an entity before your controllers action.
This happens most of the time via type hinting and priority detection kinda magic in the background.
But as magic is often obscure sometimes you need a bit of explicitness.
F.e. when you have more and different ParamConverter per entity you want to name them explicitly.
Then you can use named ParamConverters.
In the documentation this issue is a bit fragmented, so here is the compact version:
Continue reading “Symfony and named ParamConverters”
I have often missed the
method from Doctrine1 in Symfony2 with Doctrine2.
Of course there’s the doctrine extensions with the sluggable behaviour, but sometimes it seems a bit overhead for smaller tasks.
I just recently discovered Behat Transliterator, which brings just the dearly missed urlize function back.
Continue reading “Symfony2 “urlize””
Did you ever wonder how to enable 3rd party plugins (or so called “frameworks“) within the great compass toolset managed by assetic in your edgy symfony 2.1 project?
(If there is more extensive documentation available concerning assetic + CompassFilter, please stop reading on and let me know!)
If you take a look at the filter class itself (it is CompassFilter in the generic Assetic\Filter namespace), you should recognise several option values that you can use in your application wide config.yml file.
But first you have to install the framework plugin following these instructions.
Continue reading “[Symfony 2][Assetic] Sass, CompassFilter + Foundation Responsive Front-end Framework”
Actually i was a fan of YAML regarding the configuration files of Symfony2.
This was probably because i was used to it since symfony 1.4 and i also thought its better readable.
Its partly still true, but my Netbeans Editor has some problems with using @ in YAML and this breaks my highlighting.
So the better readability vanished to nirvana.
So i checked out XML configuration. Its also widely used by the community.
Pros and Cons (mostly Pros) you can read in this post by Fabien.
Continue reading “Symfony2 from YAML to XML configuration”