// composer.json
{
"require": {
"php": ">=8.2",
"ext-ctype": "*",
"ext-iconv": "*",
"composer/package-versions-deprecated": "^1.11", // 1.11.99.1
"doctrine/annotations": "^1.0", // 1.12.1
"doctrine/doctrine-bundle": "^2", // 2.3.1
"doctrine/doctrine-migrations-bundle": "^3", // 3.1.1
"doctrine/orm": "^2", // 2.8.4
"knplabs/knp-time-bundle": "^1.15", // v1.16.0
"phpdocumentor/reflection-docblock": "^5.2", // 5.2.2
"sensio/framework-extra-bundle": "^6.0", // v6.1.2
"symfony/console": "5.2.*", // v5.2.6
"symfony/dotenv": "5.2.*", // v5.2.4
"symfony/flex": "^1.9", // v1.21.6
"symfony/form": "5.2.*", // v5.2.6
"symfony/framework-bundle": "5.2.*", // v5.2.6
"symfony/http-client": "5.2.*", // v5.2.6
"symfony/mailer": "5.2.*", // v5.2.6
"symfony/property-access": "5.2.*", // v5.2.4
"symfony/property-info": "5.2.*", // v5.2.4
"symfony/security-bundle": "5.2.*", // v5.2.6
"symfony/serializer": "5.2.*", // v5.2.4
"symfony/twig-bundle": "5.2.*", // v5.2.4
"symfony/validator": "5.2.*", // v5.2.6
"symfony/webpack-encore-bundle": "^1.6", // v1.11.1
"symfony/yaml": "5.2.*", // v5.2.5
"twig/cssinliner-extra": "^3.3", // v3.3.0
"twig/extra-bundle": "^2.12|^3.0", // v3.3.0
"twig/twig": "^2.12|^3.0" // v3.3.0
},
"require-dev": {
"doctrine/doctrine-fixtures-bundle": "^3.2", // 3.4.0
"fakerphp/faker": "^1.13", // v1.14.1
"symfony/debug-bundle": "^5.2", // v5.2.4
"symfony/maker-bundle": "^1.13", // v1.30.2
"symfony/monolog-bundle": "^3.0", // v3.7.0
"symfony/stopwatch": "^5.2", // v5.2.4
"symfony/var-dumper": "^5.2", // v5.2.6
"symfony/web-profiler-bundle": "^5.2" // v5.2.6
}
}
4 Comments
I still meet developers where the only interfaces they inject are the interfaces from Symfony components. The other classes (i.e. other than Symfony services) they inject are the concrete, custom classes. And they even say that it's fine because they want "this" class. But what's even more interesting to me is why they have never asked themselves why the heck Symfony is using interfaces everywhere and maybe it's something they should reconsider.
Oh sorry, they use interfaces - when they need to write a mock client for some external HTTP service so they can turn on the real client only in production.
Hey Fabien,
You can't learn without doing mistakes of course :) But I agree, it would be good to mention in the course. It's always a balance. Sometimes, it's hard to think in advance you write a rough first version, then look at the whole picture again, and refactor it to make it even better. And that's a totally ok too, developing is a constant refactoring, in practice, you can just add new features without refactoring existent.
> Oh sorry, they use interfaces - when they need to write a mock client for some external HTTP service so they can turn on the real client only in production.
This is already a good sing, probably better than adding a boolean field that will choose what implementation in the concrete class to run :) Though, sometimes such boolean flags may help too, so mostly it depends on a concrete use case.
Thank you for sharing your thoughts on it!
Cheers!
"And they even say that it's fine because they want "this" class" - before this sentence I forgot to write that the other classes (i.e. other than Symfony services) they inject are the concrete, custom classes.
Hey Fabien,
Done! I edited your first comment and added that sentence :)
P.S. You can easily edit your comments, watch for "Edit" link below your comments.
Cheers!
"Houston: no signs of life"
Start the conversation!