What does mean ?
Not used services are removed! - you can debug it in cache files (key: removed_ids)
What is purpose ?
Change and configure services in specific way.
When can be useful ?
In case of developing bundle. Compiler pass configure services - especially when we want load some external services as arguments
- List services which you can use with type hinting to directly fetch them
php bin/console debug:autowiring
Example output
...
Symfony\Component\String\Slugger\SluggerInterface (slugger)
Covers most simple to advanced caching needs.
Symfony\Contracts\Cache\CacheInterface (cache.app)
Allows invalidating cached items using tags.
Symfony\Contracts\Cache\TagAwareCacheInterface (cache.app.taggable)
...
(cache.app.taggable) is an id of service
Autowiring means you can use TagAwareCacheInterface or CacheInterface to inject for example in your controller
public function index(TagAwareCacheInterface $service)
{
// ...
}
- List Twig service functions In this case twig
php bin/console debug:twig
- Messenger
List all classes connected with command bus php bin/console debug:messenger
- Dump selected configuration
Shows examples of configuration. The real configuration is available by debug:config.
php bin/console config:dump KnpMarkdownBundle
- Show direct/real configuration
With cache key for specified part of config. You can use any which exist.
php bin/console debug:config FrameworkBundle cache
- List all available services There are a full list of services, but not each can be autowiring by type hinting
php bin/console debug:container
- Parameters
In config:
parameters:
cache_adapter: cache.adaper.filesystem
Usage in another yaml file using % sign.
framework:
cache:
app: '%cache_adapter%'
- List all parameters in app:
php bin/console debug:container --parameters
-
Don't commit sensitive data in
.env
. Just createenv.local
for development on local environment. Every value puts in this file overrides.env
..local
files are ignore by GIT. -
Display envs
php bin/console debug:container --env-vars
- The environments variables which should use with your tests should be stored in for e.g file
.env.test
- To run Symfony environments with 100% sure with testing envs just run
$ APP_ENV=test php bin/phpunit