Rights Reserved Contents are provided for strictly personal use. No part of these contents may be reproduced, stored in a retrieval system, publicly shared or transmitted in any form or by any means. Disclaimer Contents are distributed on an "as is" basis, without warranty. Although every precaution has been taken in the preparation of this work, neither the authors nor SensioLabs shall have any liability to any person or entity with respect to any loss or damage caused or alleged to be caused directly or indirectly by the information contained in this work.
sensible default config. • Adding new components/bundles and configuring them can be a complicated task. • Flex will automatically enable a bundle in all environments. How to add functions to a Flex project?
installed • maintained by the core team • stored in the symfony/recipes repository • automatically applied when the package is installed What is a recipe?
to use. Use the alias to let Flex make the choice for you (e.g. admin, orm, etc.). Alternatives can still be installed using their full package name. Flex makes choices for you
set of packages • maintainers of other bundles cannot add their own recipes • the selection is opionated and the choice is made by the core team • only for MIT licensed packages Limitation of core recipes
id will be treated as the FQCN Class based service ids services: AppBundle\Service\ExampleService: ~ # is equivalent to AppBundle\Service\ExampleService: class: AppBundle\Service\ExampleService
can exclude directories or files # but if a service is unused, it's removed anyway #exclude: '../src/{Entity,Migrations,Repository,Tests}' exclude: '../src/{Entity}' # refine service definitions AppBundle\Service\ExampleService: arguments: # bind arguments that cannot be autowired $someArgument: 'some_value'
container parameters to be set. Some cloud hosting providers do not make these credentials available. Env var placeholders allow to inject and replace options at runtime.
is expected to be an integer in PHP code) • to pass structured data (e.g. arrays) you need more env vars • reading from files for security reasons not possible Non-string environment variables
consuming task. However, recalculating them on every request may not always be necessary. Caches can be used to share the same result between requests to save resources. The Cache component
• They are never used directly be the end-user, but will only be configured once. • Developers only act with the cache through cache pools. Cache adapters
data. It is not used automatically by the framework. Application developers must make use of the cache.app service to store data into and retrieve data from the app cache. The app cache pool will be used for autowiring by default. The app cache pool
$keys = array()); public function hasItem($key); public function clear(); public function deleteItem($key); public function deleteItems(array $keys); public function save(CacheItemInterface $item); public function saveDeferred(CacheItemInterface $item); public function commit(); }
// return the cached value if possible if ($item->isHit()) { return $item->get(); } // compute some $value $item->set($value); $cache->save($item) ; return $value; }
null); public function set($key, $value, $ttl = null); public function delete($key); public function clear(); public function getMultiple($keys, $default = null); public function setMultiple($values, $ttl = null); public function deleteMultiple($keys); public function has($key); }