You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

296 lines
12 KiB

3 years ago
  1. CHANGELOG
  2. =========
  3. 5.3
  4. ---
  5. * Already encoded slashes are not decoded nor double-encoded anymore when generating URLs
  6. * Add support for per-env configuration in XML and Yaml loaders
  7. * Deprecate creating instances of the `Route` annotation class by passing an array of parameters
  8. * Add `RoutingConfigurator::env()` to get the current environment
  9. 5.2.0
  10. -----
  11. * Added support for inline definition of requirements and defaults for host
  12. * Added support for `\A` and `\z` as regex start and end for route requirement
  13. * Added support for `#[Route]` attributes
  14. 5.1.0
  15. -----
  16. * added the protected method `PhpFileLoader::callConfigurator()` as extension point to ease custom routing configuration
  17. * deprecated `RouteCollectionBuilder` in favor of `RoutingConfigurator`.
  18. * added "priority" option to annotated routes
  19. * added argument `$priority` to `RouteCollection::add()`
  20. * deprecated the `RouteCompiler::REGEX_DELIMITER` constant
  21. * added `ExpressionLanguageProvider` to expose extra functions to route conditions
  22. * added support for a `stateless` keyword for configuring route stateless in PHP, YAML and XML configurations.
  23. * added the "hosts" option to be able to configure the host per locale.
  24. * added `RequestContext::fromUri()` to ease building the default context
  25. 5.0.0
  26. -----
  27. * removed `PhpGeneratorDumper` and `PhpMatcherDumper`
  28. * removed `generator_base_class`, `generator_cache_class`, `matcher_base_class` and `matcher_cache_class` router options
  29. * `Serializable` implementing methods for `Route` and `CompiledRoute` are final
  30. * removed referencing service route loaders with a single colon
  31. * Removed `ServiceRouterLoader` and `ObjectRouteLoader`.
  32. 4.4.0
  33. -----
  34. * Deprecated `ServiceRouterLoader` in favor of `ContainerLoader`.
  35. * Deprecated `ObjectRouteLoader` in favor of `ObjectLoader`.
  36. * Added a way to exclude patterns of resources from being imported by the `import()` method
  37. 4.3.0
  38. -----
  39. * added `CompiledUrlMatcher` and `CompiledUrlMatcherDumper`
  40. * added `CompiledUrlGenerator` and `CompiledUrlGeneratorDumper`
  41. * deprecated `PhpGeneratorDumper` and `PhpMatcherDumper`
  42. * deprecated `generator_base_class`, `generator_cache_class`, `matcher_base_class` and `matcher_cache_class` router options
  43. * `Serializable` implementing methods for `Route` and `CompiledRoute` are marked as `@internal` and `@final`.
  44. Instead of overwriting them, use `__serialize` and `__unserialize` as extension points which are forward compatible
  45. with the new serialization methods in PHP 7.4.
  46. * exposed `utf8` Route option, defaults "locale" and "format" in configuration loaders and configurators
  47. * added support for invokable service route loaders
  48. 4.2.0
  49. -----
  50. * added fallback to cultureless locale for internationalized routes
  51. 4.0.0
  52. -----
  53. * dropped support for using UTF-8 route patterns without using the `utf8` option
  54. * dropped support for using UTF-8 route requirements without using the `utf8` option
  55. 3.4.0
  56. -----
  57. * Added `NoConfigurationException`.
  58. * Added the possibility to define a prefix for all routes of a controller via @Route(name="prefix_")
  59. * Added support for prioritized routing loaders.
  60. * Add matched and default parameters to redirect responses
  61. * Added support for a `controller` keyword for configuring route controllers in YAML and XML configurations.
  62. 3.3.0
  63. -----
  64. * [DEPRECATION] Class parameters have been deprecated and will be removed in 4.0.
  65. * router.options.generator_class
  66. * router.options.generator_base_class
  67. * router.options.generator_dumper_class
  68. * router.options.matcher_class
  69. * router.options.matcher_base_class
  70. * router.options.matcher_dumper_class
  71. * router.options.matcher.cache_class
  72. * router.options.generator.cache_class
  73. 3.2.0
  74. -----
  75. * Added support for `bool`, `int`, `float`, `string`, `list` and `map` defaults in XML configurations.
  76. * Added support for UTF-8 requirements
  77. 2.8.0
  78. -----
  79. * allowed specifying a directory to recursively load all routing configuration files it contains
  80. * Added ObjectRouteLoader and ServiceRouteLoader that allow routes to be loaded
  81. by calling a method on an object/service.
  82. * [DEPRECATION] Deprecated the hardcoded value for the `$referenceType` argument of the `UrlGeneratorInterface::generate` method.
  83. Use the constants defined in the `UrlGeneratorInterface` instead.
  84. Before:
  85. ```php
  86. $router->generate('blog_show', ['slug' => 'my-blog-post'], true);
  87. ```
  88. After:
  89. ```php
  90. use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
  91. $router->generate('blog_show', ['slug' => 'my-blog-post'], UrlGeneratorInterface::ABSOLUTE_URL);
  92. ```
  93. 2.5.0
  94. -----
  95. * [DEPRECATION] The `ApacheMatcherDumper` and `ApacheUrlMatcher` were deprecated and
  96. will be removed in Symfony 3.0, since the performance gains were minimal and
  97. it's hard to replicate the behavior of PHP implementation.
  98. 2.3.0
  99. -----
  100. * added RequestContext::getQueryString()
  101. 2.2.0
  102. -----
  103. * [DEPRECATION] Several route settings have been renamed (the old ones will be removed in 3.0):
  104. * The `pattern` setting for a route has been deprecated in favor of `path`
  105. * The `_scheme` and `_method` requirements have been moved to the `schemes` and `methods` settings
  106. Before:
  107. ```yaml
  108. article_edit:
  109. pattern: /article/{id}
  110. requirements: { '_method': 'POST|PUT', '_scheme': 'https', 'id': '\d+' }
  111. ```
  112. ```xml
  113. <route id="article_edit" pattern="/article/{id}">
  114. <requirement key="_method">POST|PUT</requirement>
  115. <requirement key="_scheme">https</requirement>
  116. <requirement key="id">\d+</requirement>
  117. </route>
  118. ```
  119. ```php
  120. $route = new Route();
  121. $route->setPattern('/article/{id}');
  122. $route->setRequirement('_method', 'POST|PUT');
  123. $route->setRequirement('_scheme', 'https');
  124. ```
  125. After:
  126. ```yaml
  127. article_edit:
  128. path: /article/{id}
  129. methods: [POST, PUT]
  130. schemes: https
  131. requirements: { 'id': '\d+' }
  132. ```
  133. ```xml
  134. <route id="article_edit" pattern="/article/{id}" methods="POST PUT" schemes="https">
  135. <requirement key="id">\d+</requirement>
  136. </route>
  137. ```
  138. ```php
  139. $route = new Route();
  140. $route->setPath('/article/{id}');
  141. $route->setMethods(['POST', 'PUT']);
  142. $route->setSchemes('https');
  143. ```
  144. * [BC BREAK] RouteCollection does not behave like a tree structure anymore but as
  145. a flat array of Routes. So when using PHP to build the RouteCollection, you must
  146. make sure to add routes to the sub-collection before adding it to the parent
  147. collection (this is not relevant when using YAML or XML for Route definitions).
  148. Before:
  149. ```php
  150. $rootCollection = new RouteCollection();
  151. $subCollection = new RouteCollection();
  152. $rootCollection->addCollection($subCollection);
  153. $subCollection->add('foo', new Route('/foo'));
  154. ```
  155. After:
  156. ```php
  157. $rootCollection = new RouteCollection();
  158. $subCollection = new RouteCollection();
  159. $subCollection->add('foo', new Route('/foo'));
  160. $rootCollection->addCollection($subCollection);
  161. ```
  162. Also one must call `addCollection` from the bottom to the top hierarchy.
  163. So the correct sequence is the following (and not the reverse):
  164. ```php
  165. $childCollection->addCollection($grandchildCollection);
  166. $rootCollection->addCollection($childCollection);
  167. ```
  168. * [DEPRECATION] The methods `RouteCollection::getParent()` and `RouteCollection::getRoot()`
  169. have been deprecated and will be removed in Symfony 2.3.
  170. * [BC BREAK] Misusing the `RouteCollection::addPrefix` method to add defaults, requirements
  171. or options without adding a prefix is not supported anymore. So if you called `addPrefix`
  172. with an empty prefix or `/` only (both have no relevance), like
  173. `addPrefix('', $defaultsArray, $requirementsArray, $optionsArray)`
  174. you need to use the new dedicated methods `addDefaults($defaultsArray)`,
  175. `addRequirements($requirementsArray)` or `addOptions($optionsArray)` instead.
  176. * [DEPRECATION] The `$options` parameter to `RouteCollection::addPrefix()` has been deprecated
  177. because adding options has nothing to do with adding a path prefix. If you want to add options
  178. to all child routes of a RouteCollection, you can use `addOptions()`.
  179. * [DEPRECATION] The method `RouteCollection::getPrefix()` has been deprecated
  180. because it suggested that all routes in the collection would have this prefix, which is
  181. not necessarily true. On top of that, since there is no tree structure anymore, this method
  182. is also useless. Don't worry about performance, prefix optimization for matching is still done
  183. in the dumper, which was also improved in 2.2.0 to find even more grouping possibilities.
  184. * [DEPRECATION] `RouteCollection::addCollection(RouteCollection $collection)` should now only be
  185. used with a single parameter. The other params `$prefix`, `$default`, `$requirements` and `$options`
  186. will still work, but have been deprecated. The `addPrefix` method should be used for this
  187. use-case instead.
  188. Before: `$parentCollection->addCollection($collection, '/prefix', [...], [...])`
  189. After:
  190. ```php
  191. $collection->addPrefix('/prefix', [...], [...]);
  192. $parentCollection->addCollection($collection);
  193. ```
  194. * added support for the method default argument values when defining a @Route
  195. * Adjacent placeholders without separator work now, e.g. `/{x}{y}{z}.{_format}`.
  196. * Characters that function as separator between placeholders are now whitelisted
  197. to fix routes with normal text around a variable, e.g. `/prefix{var}suffix`.
  198. * [BC BREAK] The default requirement of a variable has been changed slightly.
  199. Previously it disallowed the previous and the next char around a variable. Now
  200. it disallows the slash (`/`) and the next char. Using the previous char added
  201. no value and was problematic because the route `/index.{_format}` would be
  202. matched by `/index.ht/ml`.
  203. * The default requirement now uses possessive quantifiers when possible which
  204. improves matching performance by up to 20% because it prevents backtracking
  205. when it's not needed.
  206. * The ConfigurableRequirementsInterface can now also be used to disable the requirements
  207. check on URL generation completely by calling `setStrictRequirements(null)`. It
  208. improves performance in production environment as you should know that params always
  209. pass the requirements (otherwise it would break your link anyway).
  210. * There is no restriction on the route name anymore. So non-alphanumeric characters
  211. are now also allowed.
  212. * [BC BREAK] `RouteCompilerInterface::compile(Route $route)` was made static
  213. (only relevant if you implemented your own RouteCompiler).
  214. * Added possibility to generate relative paths and network paths in the UrlGenerator, e.g.
  215. "../parent-file" and "//example.com/dir/file". The third parameter in
  216. `UrlGeneratorInterface::generate($name, $parameters = [], $referenceType = self::ABSOLUTE_PATH)`
  217. now accepts more values and you should use the constants defined in `UrlGeneratorInterface` for
  218. claritiy. The old method calls with a Boolean parameter will continue to work because they
  219. equal the signature using the constants.
  220. 2.1.0
  221. -----
  222. * added RequestMatcherInterface
  223. * added RequestContext::fromRequest()
  224. * the UrlMatcher does not throw a \LogicException anymore when the required
  225. scheme is not the current one
  226. * added TraceableUrlMatcher
  227. * added the possibility to define options, default values and requirements
  228. for placeholders in prefix, including imported routes
  229. * added RouterInterface::getRouteCollection
  230. * [BC BREAK] the UrlMatcher urldecodes the route parameters only once, they
  231. were decoded twice before. Note that the `urldecode()` calls have been
  232. changed for a single `rawurldecode()` in order to support `+` for input
  233. paths.
  234. * added RouteCollection::getRoot method to retrieve the root of a
  235. RouteCollection tree
  236. * [BC BREAK] made RouteCollection::setParent private which could not have
  237. been used anyway without creating inconsistencies
  238. * [BC BREAK] RouteCollection::remove also removes a route from parent
  239. collections (not only from its children)
  240. * added ConfigurableRequirementsInterface that allows to disable exceptions
  241. (and generate empty URLs instead) when generating a route with an invalid
  242. parameter value