-
Bug fixes
- [Plug] Ensure session and flash are serializable to JSON
-
Backwards incompatible changes
- [Channel] The error return signature has been changed from
{:error, socket, reason}to {:error, reason, socket}` - [Plug]
Plug.CSRFProtectionnow uses a cookie instead of session and expects a"_csrf_token"parameter instead of"csrf_token" - [Router] The
destroyaction has been renamed todelete
- [Channel] The error return signature has been changed from
See these 0.7.x to 0.8.0 upgrade instructions to bring your existing apps up to speed.
-
Enhancements
- [Router]
protect_from_forgeryhas been added to the Router for CSRF protection. This is automatically plugged in new projects. See this example for plugging in your existing router pipeline(s) - [Router] New
socketmacro allows scoping channels to different transports and mounting multiple socket endpoints - [Channels] The "topic" abstraction has been refined to be a simple string identifier to provide more direct integration with the
Phoenix.PubSublayer - [Channels] Channels can now intercept outgoing messages and customize the broadcast for a socket-by-socket customization, message dropping, etc
- [Channels] A channel can be left by returning
{:leave, socket}from a channel callback to unsubscribe from the channel - [Channels] Channel Serializer can now use binary protocol over websockets instead of just text
- [Endpoint] Allow the reloadable paths to be configured in the endpoint
- [Mix] Allow the code generation namespace to be configured with the
:app_namespaceoption - [Mix] Allow
:reloadable_pathsin Endpoint configuration to reload directories other than"web"in development
- [Router]
-
Bug Fixes
- [Channel] Fix WebSocket heartbeat causing unnecessary
%Phoenix.Socket{}'s to be tracked and leave errors on disconnect - [Mix] Ensure Phoenix can serve and code reload inside umbrella apps
- [Channel] Fix WebSocket heartbeat causing unnecessary
-
Backwards incompatible changes
- [Endpoint] Endpoints should now be explicitly started in your application supervision tree. Just add
supervisor(YourApp.Endpoint, [])to your supervision tree inlib/your_app.ex mix phoenix.startwas renamed tomix phoenix.server- [Endpoint] The
YourApp.Endpoint.start/0function was removed. You can simply remove it from yourtest/test_helper.exfile - [Router] Generated named paths now expect a conn arg. For example,
MyApp.Router.Helpers.page_path(conn, :show, "hello")instead ofMyApp.Router.Helpers.page_path(:show, "hello") - [Controller]
Phoenix.Controller.Flashhas been removed in favor offetch_flash/2,get_flash/2, andput_flash/2functions onPhoenix.Controller - [Router]
Phoenix.Router.Sockethas been removed in favor of newPhoenix.Router.socket/2macro. - [Router] The
channelmacro now requires a topic pattern to be used to match incoming channel messages to a channel handler. SeePhoenix.Router.channel/2for details. - [Channel] The
event/3callback has been renamed tohandle_in/3and the argument order has changed todef handle_in("some:event", msg, socket) - [Channel] Channel callback return signatures have changed and now require
{:ok, socket} | {:leave, socket| | {:error, socket, reason}.terminate/2andhibernate/2have also been removed.
- [Endpoint] Endpoints should now be explicitly started in your application supervision tree. Just add
-
Enhancements
- [Mix] Update Plug to
0.9.0. You can now remove the Plug git dep from yourmix.exs.
- [Mix] Update Plug to
-
Bug fixes
- [Endpoint] Ensure CodeReloader is removed fron Endpoint when disabled
- Bug fixes
- [Phoenix] Include Plug dep in new project generation since it's a github dep until next Plug release.
See these 0.6.x to 0.7.0 upgrade instructions to bring your existing apps up to speed.
-
Enhancements
- [Endpoint] Introduce the concept of endpoints which removes some of the responsibilities from the router
- [Endpoint] Move configuration from the :phoenix application to the user own OTP app
-
Bug fixes
- [Router] Fix a bug where the error rendering layer was not picking JSON changes
- [CodeReloader] Fix a bug where the code reloader was unable to recompile when the router could not compile
-
Backwards incompatible changes
- [I18n]
Linguisthas been removed as a dependency, and anI18nmodule is no longer generated in your project - [View]
ErrorsViewhas been renamed toErrorView, update yourMyApp.ErrorsViewaccordingly - [Controller]
html/2,json/2,text/2,redirect/2andrender/3no longer halt automatically - [Router] Configuration is no longer stored in the router but in the application endpoint. The before pipeline was also removed and move to the endpoint itself
- [I18n]
- Bug fixes
- [Mix] Fix phoenix dep reference in new project generator
- Enhancements
- [Controller] Allow sensitive parameters to be filtered from logs
- [Router] Add ability for routes to be scoped by hostname via the :host option
- [Router] Add
Plug.Debuggerthat shows helpful error pages in case of failures - [Router] Add
Phoenix.Router.RenderErrorswhich dispatches to a view for rendering in case of crashes - [Router] Log which pipelines were triggered during a request
- [Channel] Allows custom serializers to be configured for WebSocket Transport
See the 0.5.x to 0.6.0 upgrade instructions for upgrading your
existing applications.
-
Enhancements
- [Controller] Support
put_view/2to configure which view to use when rendering in the controller - [Controller] Support templates as an atom in
Phoenix.Controller.render/3as a way to explicitly render templates based on the request format - [Controller] Split paths from external urls in
redirect/2 - [Controller]
json/2automatically encodes the data to JSON by using the registered:format_encoders - [Controller]
html/2,json/2,text/2,redirect/2andrender/3now halt automatically - [Controller] Add
accepts/2for content negotiation - [Controller] Add
put_layout_formats/2andlayout_formats/1to configure and read which formats have a layout when rendering - [View] Assigns are always guaranteed to be maps
- [View] Add support to
format_encodersthat automatically encodes rendered templates. This means a "user.json" template only needs to return a map (or any structure encodable to JSON) and it will be automatically encoded to JSON by Phoenix - [View] Add a .exs template engine
- [Channel] Add a
Transportcontract for custom Channel backends - [Channel] Add a
LongPollertransport with automatic LP fallback inphoenix.js - [phoenix.js] Add long-polling support with automatic LP fallback for older browsers
- [Controller] Support
-
Deprecations
- [Controller]
html/3,json/3,text/3andredirect/3were deprecated in favor of usingput_status/2 - [Controller]
redirect(conn, url)was deprecated in favor ofredirect(conn, to: url)
- [Controller]
-
Backwards incompatible changes
- [Controller] Passing a string to render without format in the
controller, as in
render(conn, "show")no longer works. You should either make the format explicitrender(conn, "show.html")or use an atomrender(conn, :show)to dynamically render based on the format - [View] Using
:withinwas renamed in favor of:layoutfor rendering with layouts - [View] Your application should now directly use Phoenix.View in
its main view and specify further configuration in the
using(...)section - [View] Template engines now should implement compile and simply return the quoted expression of the function body instead of the quoted expression of the render function
- [Router]
PUTroute generation for the:updateaction has been dropped in favor ofPATCH, butPUTstill matches requests to maintain compatibility with proxies. - [Router] Router no longer defines default :browser and :api pipelines
- [Controller] Passing a string to render without format in the
controller, as in
-
Bug fixes
- [Router] Generate correct route for helper path on root
-
Enhancements
- [Router] Named helpers are now automatically generated for every route based on the controller name
- [Router] Named helpers have been optimized to do as little work as possible at runtime
- [Router] Support multiple pipelines at the router level
- [Channels] The
phoenix.jschannel client now sends a configurable heartbeat every 30s to maintain connections
-
Deprecations
- [Controller]
assign_privateis deprecated in favor ofput_private - [Controller]
assign_statusis deprecated in favor ofput_status
- [Controller]
-
Backwards incompatible changes
- [Controller] Remove default, injected aliases:
Flash,JSON - [Controller] Controllers now require
plug :actionto be explicitly invoked - [Router]
*pathidentifiers in routers are now returned as a list - [Router] Named helpers are now defined in a explicit module nested
to your router. For example, if your router is named
MyApp.Router, the named helpers will be available atMyApp.Router.Helpers - [Router]
session_secretconfiguration is deprecated in favor ofsecret_key_base - [Router] Plugs can now only be defined inside pipelines. All routers now need to explicitly declare which pipeline they want to use
- [Router] Router configuration was revamped, static configuration
has been moved into
:static, session configuration into:session, parsers configuration into:parsers, the http server configuration has been moved into:http, the https configuration into:httpsand the URI information for generating URIs into:uri - [CodeReloaer] Code reloading now requires the
:phoenixcompiler to be added to the list of compilers in yourmix.exsproject config, ie:compilers: [:phoenix] ++ Mix.compilers. Additionally, thePhoenix.CodeReloader.reload!invocation should be removed from yourtest_helper.exsfor applications generated on0.4.x. - [Topic]
Phoenix.Topichas been renamed toPhoenix.PubSub. If you were calling into the topic layer directly, update your module references.
- [Controller] Remove default, injected aliases:
- Bug fixes
- [Project Generation] Fix project template dependencies pointing to incorrect phoenix and elixir versions
-
Enhancements
- [Controller] Controllers are now Plugs and can be plugged as a "second layer" plug stack from the Router plug stack
- [Controller] Elixir Logger Integration - Improved request logger, durations, params, etc
- [Controller] Custom 404/500 page handling, details
- [Controller] Ability to halt Plug stacks with Plug 0.7.0
halt/1 - [Controller] Add
assign_layout/2andassign_status/2 - [Controller] Flash messages for one-time message support across redirects
- [View] Internationalization support
- [View] New
Template.Enginebehaviour for third-party template engines. See PhoenixHaml for haml support via Calliope. render/2can be explicitly plugged for automatic rendering of actions based on action name- [Channel] Assign API for Sockets allows ephemeral state to be stored on the multiplexed socket, similar to conn assigns
- [Config] Add
proxy_portRouter config option for deployments where public facing port differs from local port - [Router] Add nested generated
Helpersmodule to Routers for easy imports of named route helpers, ieimport MyApp.Router.Helpers
-
Bug fixes
- Various bug fixes and improvements
-
Backwards incompatible changes
- [Config] ExConf Configuration has been replaced by Mix Config
- Directory and naming conventions have changed. A
web/directory now lives at root of the project and holds routers, controllers, channels, views & templates, where allweb/files are recompiled by the code reloader during development. Modules that cannot be simply recompiled in process are placed in lib as normal and require a server restart to take effect. Follow this guide for upgrade steps from 0.3.x. - Naming conventions now use singular form for module names, directory names, and named route helpers
- [Router] Named route helpers have been reworked to use single function name with pattern matched arguments. See the readme examples
- [Controller]
layout: nilrender option has been replaced byassign_layout(conn, :none) - [Plugs]
Plugs.JSONnow adds parsed params under "_json" key when the JSON object is an array
- Enhancements
- Various performance improvements
-
Enhancements
- Add Precompiled EEx Templating Engine and View layer
- Add JSON Plug parser
- Update Plug to 0.5.2 with Cookie Session support
- URL helpers ie,
Router.page_path, now properly encode nested query string params
-
Bug fixes
- Auto template compilation has been fixed for Elixir 0.14.2
@external_resourcechanges
- Auto template compilation has been fixed for Elixir 0.14.2
-
Backwards incompatible changes
- Controller action arity has changed. All actions now receive the
Plug conn and params as arguments, ie
def show(conn, %{"id" => id}) - Channel and Topic
replyandbroadcastfunctions now require a map instead of an arbitrary dict
- Controller action arity has changed. All actions now receive the
Plug conn and params as arguments, ie