1# Changelog 2 3## 1.3.3 (2018-06-15) 4 5* Enhancements 6 * [Router] cache pipeline compilation to improve performance 7 8* Bug Fixes 9 * [Phoenix.Router] Fix reraise deprecation warnings when using Plug 1.5 and above 10 * [Digester] Fix option parser warnings 11 12* Deprecations 13 * [Socket] deprecate via opton in channel/3 macro 14 15## 1.3.2 (2018-03-08) 16 17* Bug Fixes 18 * [CodeReloader] Fix error when running `phx.server` from umbrella root 19 20## 1.3.1 (2018-03-02) 21 22* Enhancements 23 * [Router] Raise on unknown `:only` and `:except` in `resources`. 24 * [Router] Include line numbers in generated routes for better reporting 25 * [Logger] Add parameter keep strategy to filter all parameters by default and selectively keep parameters 26 * [Token] Support `:infinity` for token max age 27 * [Presence] Generate `child_spec` for Elixir 1.5+ support 28 29* Bug Fixes 30 * [Transports.WebSocketSerializer] Do not encode `:join_ref` in v1 messages 31 32## 1.3.0 (2017-07-28) 33 34See these [`1.2.x` to `1.3.x` upgrade instructions](https://gist.github.com/chrismccord/71ab10d433c98b714b75c886eff17357) to bring your existing apps up to speed. 35 36* Enhancements 37 * [Generator] Add new `phx.new`, `phx.new.web`, `phx.new.ecto` project generators with improved application structure and support for umbrella applications 38 * [Generator] Add new `phx.gen.html` and `phx.gen.json` resource generators with improved isolation of API boundaries 39 * [Controller] Add `current_path` and `current_url` to generate a connection's path and url 40 * [Controller] Introduce `action_fallback` to registers a plug to call as a fallback to the controller action 41 * [Controller] Wrap exceptions at controller to maintain connection state 42 * [Channel] Add ability to configure channel event logging with `:log_join` and `:log_handle_in` options 43 * [Channel] Warn on unhandled `handle_info/2` messages 44 * [Channel] Channels now distinguish from graceful exits and application restarts, allowing clients to enter error mode and reconnected after cold deploys. 45 * [Channel] Add V2 of wire channel wire protocol with resolved race conditions and compacted payloads 46 * [ChannelTest] Subscribe `connect` to `UserSocket.id` to support testing forceful disconnects 47 * [Socket] Support static `:assigns` when defining channel routes 48 * [Router] Document `match` support for matching on any HTTP method with the special `:*` argument 49 * [Router] Populate `conn.path_params` with path parameters for the route 50 * [ConnTest] Add `redirected_params/1` to return the named params matched in the router for the redirected URL 51 * [Digester] Add `mix phx.digest.clean` to remove old versions of compiled assets 52 * [phx.new] Add Erlang 20 support in `phx.new` installer archive 53 * [phx.new] Use new `lib/my_app` and `lib/my_app_web` directory structure 54 * [phx.new] Use new `MyAppWeb` alias convention for web modules 55 56* Bug Fixes 57 * [Controller] Harden local redirect against arbitrary URL redirection 58 * [Controller] Fix issue causing flash session to remain when using `clear_flash/1` 59 60* Deprecations 61 * [Generator] All `phoenix.*` mix tasks have been deprecated in favor of new `phx.*` tasks 62 63* JavaScript client enhancements 64 * Use V2 channel wire protocol support 65 * Add ability to pass `encode` and `decode` functions to socket constructor for custom encoding and decoding of outgoing and incoming messages. 66 * Detect heartbeat timeouts on client to handle ungraceful connection loss for faster socket error detection 67 * Add support for AMD/RequireJS 68 69* JavaScript client bug fixes 70 * Resolve race conditions when join timeouts occur on client, while server channel successfully joins 71 72## 1.2.2 (2017-3-14) 73 74* Big Fixes 75 * [Controller] Harden local redirect against arbitrary URL redirection 76 77## 1.2.1 (2016-8-11) 78 79* Enhancements 80 * [Router] Improve errors for invalid route paths 81 * [Plug] Include new development error pages 82 83* Bug Fixes 84 * [Endpoint] Fixed issue where endpoint would fail to code reload on next request after an endpoint compilation error 85 86## 1.2.0 (2016-6-23) 87 88See these [`1.1.x` to `1.2.x` upgrade instructions](https://gist.github.com/chrismccord/29100e16d3990469c47f851e3142f766) to bring your existing apps up to speed. 89 90* Enhancements 91 * [CodeReloader] The `lib/` directory is now code reloaded by default along with `web/` in development 92 * [Channel] Add `subscribe/2` and `unsubscribe/2` to handle external topic subscriptions for a socket 93 * [Channel] Add `:phoenix_channel_join` instrumentation hook 94 * [View] Generate private `render_template/2` clauses for views to allow overriding `render/2` clauses before rendering templates 95 * [View] Add `:path` and `:pattern` options to allow wildcard template inclusion as well as customized template directory locations 96 97* Deprecations 98 * [Endpoint] Generated `subscribe/3` and `unsubscribe/2` clauses have been deprecated in favor of `subscribe/2` and `unsubscribe/1` which uses the caller's pid 99 * [PubSub] `Phoenix.PubSub.subscribe/3` and `Phoenix.PubSub.unsubscribe/2` have been deprecated in favor of `subscribe/2` and `unsubscribe/1` which uses the caller's pid 100 * [Watcher] Using the `:root` endpoint configuration for watchers is deprecated. Pass the :cd option at the end of your watcher argument list in config/dev.exs. For example: 101 102 ```elixir 103 watchers: [node: ["node_modules/brunch/bin/brunch", "watch", "--stdin", 104 cd: Path.expand("../", __DIR__)]] 105 ``` 106 107* Bug Fixes 108 * [Template] Prevent infinite call stack when rendering a non-existent template from `template_not_found` 109 110* Backward incompatible changes 111 * [Channel] `subscribe/1` and `unsubscribe/1` have been removed in favor of calling subscribe and unsubscribe off the endpoint directly 112 113* JavaScript client enhancements 114 * Add Presence object for syncing presence state between client and server 115 * Use return value of channel onMessage callback for specialized message transformations before dispatching to the channel 116 117* JavaScript client backward incompatible changes 118 * `Presence.syncState` and `Presence.syncDiff` now return a copy of the state instead of mutating it 119 120 121## 1.1.6 (2016-6-03) 122 123* Enhancements 124 * Add Erlang 19 compatibility 125 126## 1.1.5 (2016-6-01) 127 128* Enhancements 129 * Fix warnings for Elixir 1.3 130 131## 1.1.4 (2016-1-25) 132 133* Enhancements 134 * [phoenix.new] Update dependencies and solve problem where Mix may take too long to resolve deps 135 * [phoenix.new] Be more conservative regarding brunch dependencies 136 * [phoenix.new] Provide `local.phoenix` task 137 * [phoenix.digest] Add `?vsn=d` to digested assets 138 139## 1.1.3 (2016-1-20) 140 141* Enhancements 142 * [phoenix.gen] Support `--binary-id` option when generating scaffold 143 * [phoenix.new] Don't include Ecto gettext translations if `--no-ecto` is passed 144 145* JavaScript client bug fixes 146 * Ensure exports variable does not leak 147 * Fix `setTimeout` scoping issue for Babel 148 149## 1.1.2 (2016-1-8) 150 151See these *optional* [`1.1.1` to `1.1.2` upgrade instructions](https://gist.github.com/chrismccord/d5bc5f8e38c8f76cad33) to bring your existing apps up to speed. 152 153* Enhancements 154 * [Cowboy] Improve log report for errors from the UserSocket 155 * [ChannelTest] Add `refute_push` and `refute_reply` 156 * [Router] Improve error messages when calling Router helpers without matching clauses 157 * [phoenix.new] Use brunch 2.1.1 npm integration to load `phoenix` and `phoenix_html` js deps 158 159## 1.1.1 (2015-12-26) 160 161* Bug fixes 162 * Fix `--no-html` flag on `phoenix.new` task failing to generate ErrorHelpers module 163 164## 1.1.0 (2015-12-16) 165 166See these [`1.0.x` to `1.1.0` upgrade instructions](https://gist.github.com/chrismccord/557ef22e2a03a7992624) to bring your existing apps up to speed. 167 168* Enhancements 169 * [Router] Enable defining routes for custom http methods with a new `match` macro 170 * [CodeReloader] The socket transports now trigger the code reloader when enabled for external clients that only connect to channels without trigger a recompile through the normal page request. 171 * [phoenix.digest] The `phoenix.digest` task now digests asset urls in stylesheets automatically 172 * [Channel] Add `Phoenix.Channel.reply/3` to reply asynchronously to a channel push 173 * [Channel] `code_change/3` is now supported to upgrade channel servers 174 * [Endpoint] `check_origin` now supports wildcard hosts, ie `check_origin: ["//*.example.com"]` 175 * [Endpoint] `check_origin` treats invalid origin hosts as missing for misbehaving clients 176 * [Endpoint] Add `Phoenix.Endpoint.server?/2` to check if webserver has been configured to start 177 * [ConnTest] Add `assert_error_sent` to assert an error was wrapped and sent with a given status 178 179* Backward incompatible changes 180 * [View] The `@inner` assign has been removed in favor of explicit rendering with `render/3` and the new `@view_module` and `view_template` assigns, for example: `<%= @inner %>` is replaced by `<%= render @view_module, @view_template, assigns %>` 181 182## 1.0.4 (2015-11-30) 183 184* Enhancements 185 * [ConnTest] Add `bypass_through` to pass a connection through a Router and pipelines while bypassing route dispatch. 186 187* Bug fixes 188 * [LongPoll] force application/json content-type to fix blank JSON bodies on older IE clients using xdomain 189 190 191## 1.0.3 (2015-9-28) 192 193* Enhancements 194 * [Controller] Transform FunctionClauseError's from controller actions into ActionClauseError, and send 400 response 195 * [Router] Allow plugs to be passed to `pipe_through` 196 * [Channel] WebSocket transport now sends server heartbeats and shutdowns if client heartbeats stop. Fixes timeout issues when clients keep connection open, but hang with suspended js runtimes 197 198* JavaScript client deprecations 199 * Passing params to socket.connect() has been deprecated in favor of the `:params` option of the Socket constructor 200 201## 1.0.2 (2015-9-6) 202 203* Enhancements 204 * [Installer] Support `--database mongodb` when generating new apps 205 * [Installer] Support `binary_id` and `migration` configuration for models 206 207* Bug fixes 208 * [Digest] Ensure Phoenix app is loaded before digesting 209 * [Generator] Ensure proper keys are generated in JSON views and tests 210 * [Generator] Ensure proper titles are generated in HTML views and tests 211 * [Mix] Ensure app is compiled before showing routes with `mix phoenix.routes` 212 * [Token] Ensure max age is counted in seconds and not in milliseconds 213 214## 1.0.1 (2015-9-3) 215 216* Enhancements 217 * [Controller] `phoenix.gen.json` generator now excludes `:new` and `:edit` actions 218 * [Endpoint] Set hostname to "localhost" by default for dev and test 219 * [ConnTest] Support multiple json mime types in `json_response/2` 220 221## 1.0.0 (2015-8-28) 222 223## v0.17.1 (2015-8-26) 224 225* Enhancements 226 * [ChannelTest] Add `connect/2` helper for test UserSocket handlers 227 * [Endpoint] Expose `struct_url/0` in the endpoint that returns the URL as struct for further manipulation 228 * [Router] Allow `URI` structs to be given to generated `url/1` and `path/2` helpers 229 230* Bug fixes 231 * [Endpoint] Pass port configuration when configuring force_ssl 232 * [Mix] By default include all attributes in generated JSON views 233 * [Router] Fix `pipe_through` not respecting halting when piping through multiple pipelines 234 235## v0.17.0 (2015-8-19) 236 237See these [`0.16.x` to `0.17.0` upgrade instructions](https://gist.github.com/chrismccord/ee5ae90b949a9768b871) to bring your existing apps up to speed. 238 239* Enhancements 240 * [Endpoint] Allow `check_origin` and `force_ssl` to be config in transports and fallback to endpoint config 241 * [Transport] Log when `check_origin` fails 242 243* Bug fixes 244 * [Mix] Properly humanize names in the generator 245 246* Deprecations 247 * [Endpoint] `render_errors: [default_format: "html"]` is deprecated in favor of `render_errors: [accepts: ["html"]]` 248 249* Backward incompatible changes 250 * [Controller] The "format" param for overriding the accept header has been renamed to "_format" and is no longer injected into the params when parsing the Accept headers. Use `get_format/1` to access the negotiated format. 251 * [ChannelTest] In order to test channels, one must now explicitly create a socket and pass it to `subscribe_and_join`. For example, `subscribe_and_join(MyChannel, "my_topic")` should now become `socket() |> subscribe_and_join(MyChannel, "my_topic")` or `socket("user:id", %{user_id: 13}) |> subscribe_and_join(MyChannel, "my_topic")`. 252 253## v0.16.1 (2015-8-6) 254 255* JavaScript client bug fixes 256 * Pass socket params on reconnect 257 258## v0.16.0 (2015-8-5) 259 260See these [`0.15.x` to `0.16.0` upgrade instructions](https://gist.github.com/chrismccord/969d75d1562979a3ae37) to bring your existing apps up to speed. 261 262* Enhancements 263 * [Brunch] No longer ship with `sass-brunch` dependency 264 * [Endpoint] Add `force_ssl` support 265 * [Mix] Allow `phoenix.gen.*` tasks templates to be customized by the target application by placing copies at `priv/template/phoenix.gen.*` 266 * [Mix] Support `mix phoenix.gen.model Comment comment post_id:references:posts` 267 * [Mix] Add `mix phoenix.gen.secret` 268 * [Router] Provide `put_secure_browser_headers/2` and use it by default in the browser pipeline 269 * [Socket] Automatically check origins on socket transports 270 * [Token] Add `Phoenix.Token` for easy signing and verification of tokens 271 272* Bug fixes 273 * [Cowboy] Ensure we print proper URL when starting the server with both http and https 274 * [Digest] Do not gzip binary files like png and jpg. Default only to known text files and make them configurable via `config :phoenix, :gzippable_exts, ~w(.txt .html .js .css)` and so on 275 276* Backward incompatible changes 277 * [Controller] `jsonp/3` function has been removed in favor of the `plug :allow_jsonp` 278 * [Controller] `controller_template/1` has been renamed to `view_template/1` 279 * [HTML] Use `phoenix_html ~> 2.0` which includes its own `phoenix_html.js` version 280 * [Socket] `:origins` transport option has been renamed to `:check_origin` 281 * [View] `render_one` and `render_many` no longer inflect the view module from the model in favor of explicitly passing the view 282 283* JavaScript client backwards incompatible changes 284 * Socket params are now passed to `socket.connect()` instead of an option on the constructor. 285 * Socket params are no longer merged as default params for channel params. Use `connect/2` on the server to wire up default channel assigns. 286 * Socket `chan` has been renamed to `channel`, for example `socket.channel("some:topic")` 287 288## v0.15.0 (2015-7-27) 289 290See these [`0.14.x` to `0.15.0` upgrade instructions](https://gist.github.com/chrismccord/931373940f320bf41a50) to bring your existing apps up to speed. 291 292* Enhancements 293 * [Socket] Introduce `Phoenix.Socket` behaviour that allows socket authentication, termination, and default channel socket assigns 294 * [PubSub] Use ETS dispatch table for increased broadcast performance 295 * [Channel] Use event intercept for increased broadcast performance 296 297* Backward incompatible changes 298 * [Router] channel routes are now defined on a socket handler module instead of the Router 299 * [Router] `socket` mounts have been moved from the Router to the Endpoint 300 * [Channel] `handle_out` callbacks now require explicit event intercept for callback to be invoked, with `Phoenix.Channel.intercept/1` 301 * [Transports] WebSocket and LongPoll transport configuration has been moved from mix config to the UserSocket 302 303* JavaScript client backwards incompatible changes 304 * `Phoenix.LongPoller` has been renamed to `Phoenix.LongPoll` 305 * A new client version is required to accommodate server changes 306 307## v0.14.0 (2015-06-29) 308 309See these [`0.13.x` to `0.14.0` upgrade instructions](https://gist.github.com/chrismccord/57805158f463d3369103) to bring your existing apps up to speed. 310 311* Enhancements 312 * [Phoenix.HTML] Update to phoenix_html 1.1.0 which raises on missing assigns 313 * [Controller] Add `jsonp/2` for handling JSONP responses 314 * [Channel] Enhance logging with join information 315 * [Router] Add `forward` macro to forward a requests to a Plug, invoking the pipeline 316 317* Javascript client enhancements 318 * Add socket params to apply default, overridable params to all channel params. 319 * Enchance logging 320 321* Bug fixes 322 * [Channel] Fix xdomain content type not being treated as JSON requests 323 324* Javascript client backwards incompatible changes 325 * `logger` option to `Phoenix.Socket`, now uses three arguments, ie: `logger: (kind, msg, data) => { console.log(`${kind}: ${msg}`, data) }` 326 327* Backward incompatible changes 328 * [Controller] `plug :action` is now called automatically 329 * [Endpoint] The `:format` option in `:render_errors` has been renamed to `:default_format` 330 * [PubSub.Redis] The Redis PubSub adapter has been extracted into its own project. If using redis, see the [project's readme](https://github.com/phoenixframework/phoenix_pubsub_redis) for instructions 331 * [View] The default template `web/templates/layout/application.html.eex` has been renamed to `app.html.eex` 332 333## v0.13.1 (2015-05-16) 334 335See these [`0.13.0` to `0.13.1` upgrade instructions](https://gist.github.com/chrismccord/4a62780056b08c60542d) to bring your existing apps up to speed. 336 337* Enhancements 338 * [Channel] Add `phoenix.new.channel Channel topic` 339 * [Channel] Add `Phoenix.ChannelCase` 340 * [Controller] Assert changes in the repository on generated controller tests 341 * [Endpoint] Add `static_url` to endpoint to configure host, port and more for static urls 342 * [phoenix.new] Generate a channel case for new apps 343 * [phoenix.new] Improve installation workflow by asking to install and fetch dependencies once 344 * [phoenix.new] Add `errors_on/1` to generated model case 345 346## v0.13.0 (2015-05-11) 347 348See these [`0.12.x` to `0.13.0` upgrade instructions](https://gist.github.com/chrismccord/0a3bf5229801d61f219b) to bring your existing apps up to speed. 349 350* Enhancements 351 * [Channel] Allow router helpers to work in channels by passing a socket (instead of connection), for example: `user_path(socket, :index)` 352 * [Channel] Support replies in `join/3` 353 * [HTML] `Phoenix.HTML` has been extracted to its own project. You need to explicitly depend on it by adding `{:phoenix_html, "~> 1.0"}` to `deps` in your `mix.exs` file 354 * [HTML] `safe/1` in views is deprecated in favor of `raw/1` 355 * [Generators] Allow `belongs_to` in model generator which supports associations and indexes 356 357* Bug fixes 358 * [HTML] `select` no longer inverses the key and values in the given options 359 * [phoenix.new] Do not run `deps.get` if there is no Hex 360 361* Backward incompatible changes 362 * [Channel] To refuse joining a channel, `join/3` now requires `{:error, reason}` 363 364* Javascript client backward incompatible changes 365 * channel instances are now created from the `socket` 366 * channel joins are now called explicitly off channel instances 367 * channel onClose now only triggered on explicit client `leave` or server `:stop` 368 * Examples: 369 370 ```javascript 371 let socket = new Phoenix.Socket("/ws") 372 let chan = socket.chan("rooms:123", {}) 373 chan.join().receive("ok", ({resp} => ...).receive("error", ({reason}) => ...) 374 ``` 375 376 377## v0.12.0 (2015-04-30) 378 379See these [`0.11.x` to `0.12.0` upgrade instructions](https://gist.github.com/chrismccord/b3975ba356dba902ec88) to bring your existing apps up to speed. 380 381* Enhancements 382 * [Channel] Leaving the channel or closing the client will now trigger terminate on the channel, regardless of traping exits, with reasons `{:shutdown, :left}` and `{:shutdown, :closed}` respectively 383 * [Controller] Support `:namespace` option in controllers in order to use proper layout in namespaced applications 384 * [Controller] Add `controller_template/1` to lookup the template rendered from the controller 385 * [Generators] Add `phoenix.gen.json` 386 * [Generators] Allow models to be skipped on `phoenix.gen.json` and `phoenix.gen.html` generators 387 * [Generators] Generate test files in `phoenix.gen.html`, `phoenix.gen.json` and `phoenix.gen.model` 388 * [HTML] Add `search_input/3`, `telephone_input/3`, `url_input/3` and `range_input/3` to `Phoenix.HTML.Form` 389 * [Installer] Add the generated `config/prod.secret.exs` file to `.gitignore` by default 390 * [Static] Add a `mix phoenix.digest` task to run during deploys to generate digest filenames and gzip static files. A new configuration called `cache_static_manifest` was added which should be set to "priv/static/manifest.json" in production which will preload the manifest file generated by the mix task in order to point to the digested files when generating static paths 391 * [Test] Add `html_response/2`, `json_response/2`, `text_response/2` and `response/2` to aid connection-based testing 392 * [View] Add `render_existing/3` to render a template only if it exists without raising an error 393 * [View] Add `render_many/4` and `render_one/4` to make it easier to render collection and optional data respctivelly 394 395* Bug fixes 396 * [Channel] Ensure channels are terminated when WebSocket and LongPoller transports exit normally 397 * [Installer] Declare missing applications in generated phoenix.new app 398 * [Installer] No longer generate encryption salt in generated phoenix.new app 399 * [Installer] Generate proper credentials in phoenix.new for different databases 400 * [Mix] Ensure the serve endpoints configuration is persistent 401 * [Router] Ensure URL helpers know how to call `to_param` on query parameters 402 403## v0.11.0 (2015-04-07) 404 405See these [`0.10.x` to `0.11.0` upgrade instructions](https://gist.github.com/chrismccord/3603fd2735019f86c74b) to bring your existing apps up to speed. 406 407* Javascript client enhancements 408 * Joins are now synchronous, removing the prior issues of client race conditions 409 * Events can now be replied to from the server, for request/response style messaging 410 * Clients can now detect and react to individual channel errors and terminations 411 412* Javascript client backward incompatible changes 413 * The `Socket` instance no long connects automatically. You must explicitly call `connect()` 414 * `close()` has been renamed to `disconnect()` 415 * `send` has been renamed to `push` to unify client and server messaging commands 416 * The `join` API has changed to use synchronous messaging. Check the upgrade guide for details 417 418* Backwards incompatible changes 419 * [Generator] `mix phoenix.gen.resource` renamed to `mix phoenix.gen.html` 420 * [Channel] `reply` has been renamed to `push` to better signify we are only push a message down the socket, not replying to a specific request 421 * [Channel] The return signatures for `handle_in/3` and `handle_out/3` have changed, ie: 422 423 handle_in(event :: String.t, msg :: map, Socket.t) :: 424 {:noreply, Socket.t} | 425 {:reply, {status :: atom, response :: map}, Socket.t} | 426 {:reply, status :: atom, Socket.t} | 427 {:stop, reason :: term, Socket.t} | 428 {:stop, reason :: term, reply :: {status :: atom, response :: map}, Socket.t} | 429 {:stop, reason :: term, reply :: status :: atom, Socket.t} 430 431 handle_out(event :: String.t, msg :: map, Socket.t) :: 432 {:ok, Socket.t} | 433 {:noreply, Socket.t} | 434 {:error, reason :: term, Socket.t} | 435 {:stop, reason :: term, Socket.t} 436 437 438 * [Channel] The `leave/2` callback has been removed. If you need to cleanup/teardown when a client disconnects, trap exits and handle in `terminate/2`, ie: 439 440 def join(topic, auth_msg, socket) do 441 Process.flag(:trap_exit, true) 442 {:ok, socket} 443 end 444 445 def terminate({:shutdown, :client_left}, socket) do 446 # client left intentionally 447 end 448 def terminate(reason, socket) do 449 # terminating for another reason (connection drop, crash, etc) 450 end 451 452 * [HTML] `use Phoenix.HTML` no longer imports controller functions. You must add `import Phoenix.Controller, only: [get_flash: 2]` manually to your views or your `web.ex` 453 * [Endpoint] Code reloader must now be configured in your endpoint instead of Phoenix. Therefore, upgrade your `config/dev.exs` replacing 454 455 config :phoenix, :code_reloader, true 456 457 by 458 459 config :your_app, Your.Endpoint, code_reloader: true 460 461 * [Endpoint] Live reloader is now a dependency instead of being shipped with Phoenix. Please add `{:phoenix_live_reload, "~> 0.3"}` to your dependencies 462 * [Endpoint] The `live_reload` configuration has changed to allow a `:url` option and work with `:patterns` instead of paths: 463 464 config :your_app, Your.Endpoint, 465 code_reloader: true, 466 live_reload: [ 467 url: "ws://localhost:4000", 468 patterns: [~r{priv/static/.*(js|css|png|jpeg|jpg|gif)$}, 469 ~r{web/views/.*(ex)$}, 470 ~r{web/templates/.*(eex)$}]] 471 472 * [Endpoint] Code and live reloader must now be explicitly plugged in your endpoint. Wrap them inside `lib/your_app/endpoint.ex` in a `code_reloading?` block: 473 474 if code_reloading? do 475 plug Phoenix.LiveReloader 476 plug Phoenix.CodeReloader 477 end 478 479* Enhancements 480 * [Endpoint] Allow the default format used when rendering errors to be customized in the `render_views` configuration 481 * [HTML] Add `button/2` function to `Phoenix.HTML` 482 * [HTML] Add `textarea/3` function to `Phoenix.HTML.Form` 483 * [Controller] `render/3` and `render/4` allows a view to be specified 484 directly. 485 486* Bug fixes 487 * [HTML] Fix out of order hours, minutes and days in date/time select 488 489## v0.10.0 (2015-03-08) 490 491See these [`0.9.x` to `0.10.0` upgrade instructions](https://gist.github.com/chrismccord/cf51346c6636b5052885) to bring your existing apps up to speed. 492 493* Enhancements 494 * [CLI] Make `phoenix.new` in sync with `mix new` by making the project directory optional 495 * [Controller] Add `scrub_params/2` which makes it easy to remove and prune blank string values from parameters (usually sent by forms) 496 * [Endpoint] Runtime evaluation of `:port` configuration is now supported. When given a tuple like `{:system, "PORT"}`, the port will be referenced from `System.get_env("PORT")` at runtime as a workaround for releases where environment specific information is loaded only at compile-time 497 * [HTML] Provide `tag/2`, `content_tag/2` and `content_tag/3` helpers to make tag generation easier and safer 498 * [Router] Speed up router compilation 499 500* Backwards incompatible changes 501 * [Plug] Update to Plug 0.10.0 which moves CSRF tokens from cookies back to sessions. To avoid future bumps on the road, a `get_csrf_token/0` function has been added to controllers 502 * [PubSub] Remove the option `:options` from `:pubsub`. Just define the options alongside the pubsub configuration 503 * [Pubsub] Require the `:name` option when configuring a pubsub adapter 504 505## v0.9.0 (2015-02-12) 506 507See these [`0.8.x` to `0.9.0` upgrade instructions](https://gist.github.com/chrismccord/def6f4dc444b6a8f8d8b) to bring your existing apps up to speed. 508 509* Enhancements 510 * [PubSub/Channels] The PubSub layer now supports Redis, and is opened up to other third party adapters. It still defaults to PG2, but other adapters are convenient for non-distributed deployments or durable messaging. 511 512* Bug fixes 513 * [Plug] Ensure session and flash are serializable to JSON 514 515* Backwards incompatible changes 516 * [PubSub] The new PubSub system requires the adapter's configuration to be added to your Endpoint's mix config. 517 * [PubSub] The `Phoenix.PubSub` API now requires a registered server name, ie `Phoenix.PubSub.broadcast(MyApp.PubSub, "foo:bar", %{baz: :bang})` 518 * [Channel] Channel broadcasts from outside a socket connection now must be called from an Endpoint module directly, ie: `MyApp.Endpoint.broadcast("topic", "event", %{...})` 519 * [Channel] The error return signature has been changed from `{:error, socket, reason}` to `{:error, reason, socket}` 520 * [Plug] `Plug.CSRFProtection` now uses a cookie instead of session and expects a `"_csrf_token"` parameter instead of `"csrf_token"` 521 * [Router/Controller] The `destroy` action has been renamed to `delete`, update your controller actions and url builders accordingly 522 523 524## v0.8.0 (2015-01-11) 525 526See these [`0.7.x` to `0.8.0` upgrade instructions](https://gist.github.com/chrismccord/9434b8fa208b3aae22b6) to bring your existing apps up to speed. 527 528* Enhancements 529 * [Router] `protect_from_forgery` has been added to the Router for CSRF protection. This is automatically plugged in new projects. See [this example](https://github.com/phoenixframework/phoenix/blob/ce5ebf3d9de4412a18e6325cd0d34e1b9699fb5a/priv/template/web/router.ex#L7) for plugging in your existing router pipeline(s) 530 * [Router] New `socket` macro allows scoping channels to different transports and mounting multiple socket endpoints 531 * [Channels] The "topic" abstraction has been refined to be a simple string identifier to provide more direct integration with the `Phoenix.PubSub` layer 532 * [Channels] Channels can now intercept outgoing messages and customize the broadcast for a socket-by-socket customization, message dropping, etc 533 * [Channels] A channel can be left by returning `{:leave, socket}` from a channel callback to unsubscribe from the channel 534 * [Channels] Channel Serializer can now use binary protocol over websockets instead of just text 535 * [Endpoint] Allow the reloadable paths to be configured in the endpoint 536 * [Mix] Allow the code generation namespace to be configured with the `:namespace` option 537 * [Mix] Allow `:reloadable_paths` in Endpoint configuration to reload directories other than `"web"` in development 538 539* Bug Fixes 540 * [Channel] Fix WebSocket heartbeat causing unnecessary `%Phoenix.Socket{}`'s to be tracked and leave errors on disconnect 541 * [Mix] Ensure Phoenix can serve and code reload inside umbrella apps 542 543* Backwards incompatible changes 544 * [Endpoint] Endpoints should now be explicitly started in your application supervision tree. Just add `supervisor(YourApp.Endpoint, [])` to your supervision tree in `lib/your_app.ex` 545 * `mix phoenix.start` was renamed to `mix phoenix.server` 546 * [Endpoint] The `YourApp.Endpoint.start/0` function was removed. You can simply remove it from your `test/test_helper.ex` file 547 * [Router] Generated named paths now expect a conn arg. For example, `MyApp.Router.Helpers.page_path(conn, :show, "hello")` instead of `MyApp.Router.Helpers.page_path(:show, "hello")` 548 * [Controller] `Phoenix.Controller.Flash` has been removed in favor of `fetch_flash/2`, `get_flash/2`, and `put_flash/2` functions on `Phoenix.Controller` 549 * [Router] `Phoenix.Router.Socket` has been removed in favor of new `Phoenix.Router.socket/2` macro. 550 * [Router] The `channel` macro now requires a topic pattern to be used to match incoming channel messages to a channel handler. See `Phoenix.Router.channel/2` for details. 551 * [Channel] The `event/3` callback has been renamed to `handle_in/3` and the argument order has changed to `def handle_in("some:event", msg, socket)` 552 * [Channel] Channel callback return signatures have changed and now require `{:ok, socket} | {:leave, socket| | {:error, socket, reason}`. `terminate/2` and `hibernate/2` have also been removed. 553 554## v0.7.2 (2014-12-11) 555 556* Enhancements 557 * [Mix] Update Plug to `0.9.0`. You can now remove the Plug git dep from your `mix.exs`. 558 559* Bug fixes 560 * [Endpoint] Ensure CodeReloader is removed fron Endpoint when disabled 561 562## v0.7.1 (2014-12-09) 563 564* Bug fixes 565 * [Phoenix] Include Plug dep in new project generation since it's a github dep until next Plug release. 566 567## v0.7.0 (2014-12-09) 568See these [`0.6.x` to `0.7.0` upgrade instructions](https://gist.github.com/chrismccord/c24b2b516066d987f4fe) to bring your existing apps up to speed. 569 570* Enhancements 571 * [Endpoint] Introduce the concept of endpoints which removes some of the responsibilities from the router 572 * [Endpoint] Move configuration from the :phoenix application to the user own OTP app 573 574* Bug fixes 575 * [Router] Fix a bug where the error rendering layer was not picking JSON changes 576 * [CodeReloader] Fix a bug where the code reloader was unable to recompile when the router could not compile 577 578* Backwards incompatible changes 579 * [I18n] `Linguist` has been removed as a dependency, and an `I18n` module is no longer generated in your project 580 * [View] `ErrorsView` has been renamed to `ErrorView`, update your `MyApp.ErrorsView` accordingly 581 * [Controller] `html/2`, `json/2`, `text/2`, `redirect/2` and 582`render/3` no longer halt automatically 583 * [Router] Configuration is no longer stored in the router but in the application endpoint. The before pipeline was also removed and moved to the endpoint itself 584 585## v0.6.2 (2014-12-07) 586 587* Bug fixes 588 * [Mix] Fix phoenix dep reference in new project generator 589 590## v0.6.1 (2014-11-30) 591 592* Enhancements 593 * [Controller] Allow sensitive parameters to be filtered from logs 594 * [Router] Add ability for routes to be scoped by hostname via the :host option 595 * [Router] Add `Plug.Debugger` that shows helpful error pages in case of failures 596 * [Router] Add `Phoenix.Router.RenderErrors` which dispatches to a view for rendering in case of crashes 597 * [Router] Log which pipelines were triggered during a request 598 * [Channel] Allows custom serializers to be configured for WebSocket Transport 599 600## v0.6.0 (2014-11-22) 601 602See the [`0.5.x` to `0.6.0` upgrade instructions](https://gist.github.com/chrismccord/e774e6ab5220e6505a03) for upgrading your 603existing applications. 604 605* Enhancements 606 * [Controller] Support `put_view/2` to configure which view to use 607when rendering in the controller 608 * [Controller] Support templates as an atom in 609`Phoenix.Controller.render/3` as a way to explicitly render templates 610based on the request format 611 * [Controller] Split paths from external urls in `redirect/2` 612 * [Controller] `json/2` automatically encodes the data to JSON by 613using the registered `:format_encoders` 614 * [Controller] `html/2`, `json/2`, `text/2`, `redirect/2` and 615`render/3` now halt automatically 616 * [Controller] Add `accepts/2` for content negotiation 617 * [Controller] Add `put_layout_formats/2` and `layout_formats/1` to 618configure and read which formats have a layout when rendering 619 * [View] Assigns are always guaranteed to be maps 620 * [View] Add support to `format_encoders` that automatically encodes 621rendered templates. This means a "user.json" template only needs to 622return a map (or any structure encodable to JSON) and it will be 623automatically encoded to JSON by Phoenix 624 * [View] Add a .exs template engine 625 * [Channel] Add a `Transport` contract for custom Channel backends 626 * [Channel] Add a `LongPoller` transport with automatic LP fallback 627in `phoenix.js` 628 * [phoenix.js] Add long-polling support with automatic LP fallback 629for older browsers 630 631* Deprecations 632 * [Controller] `html/3`, `json/3`, `text/3` and `redirect/3` were 633deprecated in favor of using `put_status/2` 634 * [Controller] `redirect(conn, url)` was deprecated in favor of 635`redirect(conn, to: url)` 636 637* Backwards incompatible changes 638 * [Controller] Passing a string to render without format in the 639controller, as in `render(conn, "show")` no longer works. You should 640either make the format explicit `render(conn, "show.html")` or use an 641atom `render(conn, :show)` to dynamically render based on the format 642 * [View] Using `:within` was renamed in favor of `:layout` for 643rendering with layouts 644 * [View] Your application should now directly use Phoenix.View in 645its main view and specify further configuration in the `using(...)` 646section 647 * [View] Template engines now should implement compile and simply 648return the quoted expression of the function body instead of the 649quoted expression of the render function 650 * [Router] `PUT` route generation for the `:update` action has been 651dropped in favor of `PATCH`, but `PUT` still matches requests to maintain compatibility with proxies. 652 * [Router] Router no longer defines default :browser and :api 653pipelines 654 655* Bug fixes 656 * [Router] Generate correct route for helper path on root 657 658## v0.5.0 659 660* Enhancements 661 * [Router] Named helpers are now automatically generated for every 662route based on the controller name 663 * [Router] Named helpers have been optimized to do as little work as 664possible at runtime 665 * [Router] Support multiple pipelines at the router level 666 * [Channels] The `phoenix.js` channel client now sends a 667configurable heartbeat every 30s to maintain connections 668 669* Deprecations 670 * [Controller] `assign_private` is deprecated in favor of 671`put_private` 672 * [Controller] `assign_status` is deprecated in favor of 673`put_status` 674 675* Backwards incompatible changes 676 * [Controller] Remove default, injected aliases: `Flash`, `JSON` 677 * [Controller] Controllers now require `plug :action` to be 678explicitly invoked 679 * [Router] `*path` identifiers in routers are now returned as a list 680 * [Router] Named helpers are now defined in a explicit module nested 681to your router. For example, if your router is named `MyApp.Router`, 682the named helpers will be available at `MyApp.Router.Helpers` 683 * [Router] `session_secret` configuration is deprecated in favor of 684`secret_key_base` 685 * [Router] Plugs can now only be defined inside pipelines. All 686routers now need to explicitly declare which pipeline they want to use 687 * [Router] Router configuration was revamped, static configuration 688has been moved into `:static`, session configuration into `:session`, 689parsers configuration into `:parsers`, the http server configuration 690has been moved into `:http`, the https configuration into `:https` and 691the URI information for generating URIs into `:uri` 692 * [CodeReloaer] Code reloading now requires the `:phoenix` compiler 693to be added to the list of compilers in your `mix.exs` project config, 694ie: `compilers: [:phoenix] ++ Mix.compilers`. Additionally, the 695`Phoenix.CodeReloader.reload!` invocation should be removed from your 696`test_helper.exs` for applications generated on `0.4.x`. 697 * [Topic] `Phoenix.Topic` has been renamed to `Phoenix.PubSub`. If you were calling into the topic layer directly, update your module references. 698 699 700## v0.4.1 (2014-09-08) 701 702* Bug fixes 703 * [Project Generation] Fix project template dependencies pointing to 704incorrect phoenix and elixir versions 705 706 707## v0.4.0 (2014-08-30) 708 709* Enhancements 710 * [Controller] Controllers are now Plugs and can be plugged as a 711"second layer" plug stack from the Router plug stack 712 * [Controller] Elixir Logger Integration - Improved request logger, 713durations, params, etc 714 * [Controller] Custom 404/500 page handling, 715[details](https://github.com/phoenixframework/phoenix/blob/0b6bdffab45fc46bc1455860f2d3971d0224eeb5/README.md#custom-not-found-and-error-pages) 716 * [Controller] Ability to halt Plug stacks with Plug 0.7.0 `halt/1` 717 * [Controller] Add `assign_layout/2` and `assign_status/2` 718 * [Controller] Flash messages for one-time message support across 719redirects 720 * [View] Internationalization support 721 * [View] New `Template.Engine` behaviour for third-party template 722engines. See 723[PhoenixHaml](https://github.com/chrismccord/phoenix_haml) for haml 724support via Calliope. 725 * `render/2` can be explicitly plugged for automatic rendering of 726actions based on action name 727 * [Channel] Assign API for Sockets allows ephemeral state to be 728stored on the multiplexed socket, similar to conn assigns 729 * [Config] Add `proxy_port` Router config option for deployments 730where public facing port differs from local port 731 * [Router] Add nested generated `Helpers` module to Routers for easy 732imports of named route helpers, ie `import MyApp.Router.Helpers` 733 734 735* Bug fixes 736 * Various bug fixes and improvements 737 738* Backwards incompatible changes 739 * [Config] ExConf Configuration has been replaced by Mix Config 740 * Directory and naming conventions have changed. A `web/` directory 741now lives at root of the project and holds routers, controllers, 742channels, views & templates, where all `web/` files are recompiled by 743the code reloader during development. Modules that cannot be simply 744recompiled in process are placed in lib as normal and require a server 745restart to take effect. Follow 746[this guide](https://gist.github.com/dgoldie/2fdc90fe09ecdddb78f4) for 747upgrade steps from 0.3.x. 748 * Naming conventions now use singular form for module names, 749directory names, and named route helpers 750 * [Router] Named route helpers have been reworked to use single 751function name with pattern matched arguments. See the 752[readme examples](https://github.com/phoenixframework/phoenix/blob/0b6bdffab45fc46bc1455860f2d3971d0224eeb5/README.md#resources) 753 * [Controller] `layout: nil` render option has been replaced by 754`assign_layout(conn, :none)` 755 * [Plugs] `Plugs.JSON` now adds parsed params under "_json" key when 756the JSON object is an array 757 758 759## v0.3.1 (2014-07-04) 760* Enhancements 761 * Various performance improvements 762 763## v0.3.0 (2014-06-30) 764 765* Enhancements 766 * Add Precompiled EEx Templating Engine and View layer 767 * Add JSON Plug parser 768 * Update Plug to 0.5.2 with Cookie Session support 769 * URL helpers ie, `Router.page_path`, now properly encode nested 770query string params 771 772* Bug fixes 773 * Auto template compilation has been fixed for Elixir 0.14.2 774`@external_resource` changes 775 776* Backwards incompatible changes 777 * Controller action arity has changed. All actions now receive the 778Plug conn and params as arguments, ie `def show(conn, %{"id" => id})` 779 * Channel and Topic `reply` and `broadcast` functions now require a 780map instead of an arbitrary dict 781