- Enhancements
- [ChannelTest] Subscribe
connecttoUserSocket.idto support testing forceful disconnects - [Socket] Support static
:assignswhen defining channel routes
- [ChannelTest] Subscribe
See these 1.2.x to 1.3.x upgrade instructions to bring your existing apps up to speed.
-
Enhancements
- [Generator] Add new
phx.new,phx.new.web,phx.new.ectoproject generators with improved application structure and support for umbrella applications - [Generator] Add new
phx.gen.htmlandphx.gen.jsonresource generators with improved isolation of API boundaries - [Controller] Add
current_pathandcurrent_urlto generate a connection's path and url - [Controller] Introduce
action_fallbackto registers a plug to call as a fallback to the controller action - [Controller] Wrap exceptions at controller to maintain connection state
- [Channel] Add ability to configure channel event logging with
:log_joinand:log_handle_inoptions - [Channel] Warn on unhandled
handle_info/2messages - [Channel] Channels now distinguish from graceful exits and application restarts, allowing clients to enter error mode and reconnected after cold deploys.
- [Router] Document
matchsupport for matching on any HTTP method with the special:*argument - [Router] Populate
conn.path_paramswith path parameters for the route - [ConnTest] Add
redirected_params/1to return the named params matched in the router for the redirected URL - [Digester] Add
mix phx.digest.cleanto remove old versions of compiled assets - [phx.new] Add Erlang 20 support in
phx.newinstaller archive
- [Generator] Add new
-
Bug Fixes
- [Controller] Harden local redirect against arbitrary URL redirection
- [Controller] Fix issue causing flash session to remain when using
clear_flash/1
-
Deprecations
- [Generator] All
phoenix.*mix tasks have been deprecated in favor of newphx.*tasks
- [Generator] All
-
JavaScript client enhancements
- Add ability to pass
encodeanddecodefunctions to socket constructor for custom encoding and decoding of outgoing and incoming messages. - Detect heartbeat timeouts on client to handle ungraceful connection loss for faster socket error detection
- Add support for AMD/RequireJS
- Add ability to pass
- Big Fixes
- [Controller] Harden local redirect against arbitrary URL redirection
-
Enhancements
- [Router] Improve errors for invalid route paths
- [Plug] Include new development error pages
-
Bug Fixes
- [Endpoint] Fixed issue where endpoint would fail to code reload on next request after an endpoint compilation error
See these 1.1.x to 1.2.x upgrade instructions to bring your existing apps up to speed.
-
Enhancements
- [CodeReloader] The
lib/directory is now code reloaded by default along withweb/in development - [Channel] Add
subscribe/2andunsubscribe/2to handle external topic subscriptions for a socket - [Channel] Add
:phoenix_channel_joininstrumentation hook - [View] Generate private
render_template/2clauses for views to allow overridingrender/2clauses before rendering templates - [View] Add
:pathand:patternoptions to allow wildcard template inclusion as well as customized template directory locations
- [CodeReloader] The
-
Deprecations
-
[Endpoint] Generated
subscribe/3andunsubscribe/2clauses have been deprecated in favor ofsubscribe/2andunsubscribe/1which uses the caller's pid -
[PubSub]
Phoenix.PubSub.subscribe/3andPhoenix.PubSub.unsubscribe/2have been deprecated in favor ofsubscribe/2andunsubscribe/1which uses the caller's pid -
[Watcher] Using the
:rootendpoint configuration for watchers is deprecated. Pass the :cd option at the end of your watcher argument list in config/dev.exs. For example:watchers: [node: ["node_modules/brunch/bin/brunch", "watch", "--stdin", cd: Path.expand("../", __DIR__)]]
-
-
Bug Fixes
- [Template] Prevent infinite call stack when rendering a non-existent template from
template_not_found
- [Template] Prevent infinite call stack when rendering a non-existent template from
-
Backward incompatible changes
- [Channel]
subscribe/1andunsubscribe/1have been removed in favor of calling subscribe and unsubscribe off the endpoint directly
- [Channel]
-
JavaScript client enhancements
- Add Presence object for syncing presence state between client and server
- Use return value of channel onMessage callback for specialized message transformations before dispatching to the channel
-
JavaScript client backward incompatible changes
Presence.syncStateandPresence.syncDiffnow return a copy of the state instead of mutating it
- Enhancements
- Add Erlang 19 compatibility
- Enhancements
- Fix warnings for Elixir 1.3
- Enhancements
- [phoenix.new] Update dependencies and solve problem where Mix may take too long to resolve deps
- [phoenix.new] Be more conservative regarding brunch dependencies
- [phoenix.new] Provide
local.phoenixtask - [phoenix.digest] Add
?vsn=dto digested assets
-
Enhancements
- [phoenix.gen] Support
--binary-idoption when generating scaffold - [phoenix.new] Don't include Ecto gettext translations if
--no-ectois passed
- [phoenix.gen] Support
-
JavaScript client bug fixes
- Ensure exports variable does not leak
- Fix
setTimeoutscoping issue for Babel
See these optional 1.1.1 to 1.1.2 upgrade instructions to bring your existing apps up to speed.
- Enhancements
- [Cowboy] Improve log report for errors from the UserSocket
- [ChannelTest] Add
refute_pushandrefute_reply - [Router] Improve error messages when calling Router helpers without matching clauses
- [phoenix.new] Use brunch 2.1.1 npm integration to load
phoenixandphoenix_htmljs deps
- Bug fixes
- Fix
--no-htmlflag onphoenix.newtask failing to generate ErrorHelpers module
- Fix
See these 1.0.x to 1.1.0 upgrade instructions to bring your existing apps up to speed.
-
Enhancements
- [Router] Enable defining routes for custom http methods with a new
matchmacro - [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.
- [phoenix.digest] The
phoenix.digesttask now digests asset urls in stylesheets automatically - [Channel] Add
Phoenix.Channel.reply/3to reply asynchronously to a channel push - [Channel]
code_change/3is now supported to upgrade channel servers - [Endpoint]
check_originnow supports wildcard hosts, iecheck_origin: ["//*.example.com"] - [Endpoint]
check_origintreats invalid origin hosts as missing for misbehaving clients - [Endpoint] Add
Phoenix.Endpoint.server?/2to check if webserver has been configured to start - [ConnTest] Add
assert_error_sentto assert an error was wrapped and sent with a given status
- [Router] Enable defining routes for custom http methods with a new
-
Backward incompatible changes
- [View] The
@innerassign has been removed in favor of explicit rendering withrender/3and the new@view_moduleandview_templateassigns, for example:<%= @inner %>is replaced by<%= render @view_module, @view_template, assigns %>
- [View] The
-
Enhancements
- [ConnTest] Add
bypass_throughto pass a connection through a Router and pipelines while bypassing route dispatch.
- [ConnTest] Add
-
Bug fixes
- [LongPoll] force application/json content-type to fix blank JSON bodies on older IE clients using xdomain
-
Enhancements
- [Controller] Transform FunctionClauseError's from controller actions into ActionClauseError, and send 400 response
- [Router] Allow plugs to be passed to
pipe_through - [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
-
JavaScript client deprecations
- Passing params to socket.connect() has been deprecated in favor of the
:paramsoption of the Socket constructor
- Passing params to socket.connect() has been deprecated in favor of the
-
Enhancements
- [Installer] Support
--database mongodbwhen generating new apps - [Installer] Support
binary_idandmigrationconfiguration for models
- [Installer] Support
-
Bug fixes
- [Digest] Ensure Phoenix app is loaded before digesting
- [Generator] Ensure proper keys are generated in JSON views and tests
- [Generator] Ensure proper titles are generated in HTML views and tests
- [Mix] Ensure app is compiled before showing routes with
mix phoenix.routes - [Token] Ensure max age is counted in seconds and not in milliseconds
- Enhancements
- [Controller]
phoenix.gen.jsongenerator now excludes:newand:editactions - [Endpoint] Set hostname to "localhost" by default for dev and test
- [ConnTest] Support multiple json mime types in
json_response/2
- [Controller]
-
Enhancements
- [ChannelTest] Add
connect/2helper for test UserSocket handlers - [Endpoint] Expose
struct_url/0in the endpoint that returns the URL as struct for further manipulation - [Router] Allow
URIstructs to be given to generatedurl/1andpath/2helpers
- [ChannelTest] Add
-
Bug fixes
- [Endpoint] Pass port configuration when configuring force_ssl
- [Mix] By default include all attributes in generated JSON views
- [Router] Fix
pipe_throughnot respecting halting when piping through multiple pipelines
See these 0.16.x to 0.17.0 upgrade instructions to bring your existing apps up to speed.
-
Enhancements
- [Endpoint] Allow
check_originandforce_sslto be config in transports and fallback to endpoint config - [Transport] Log when
check_originfails
- [Endpoint] Allow
-
Bug fixes
- [Mix] Properly humanize names in the generator
-
Deprecations
- [Endpoint]
render_errors: [default_format: "html"]is deprecated in favor ofrender_errors: [accepts: ["html"]]
- [Endpoint]
-
Backward incompatible changes
- [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/1to access the negotiated format. - [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 becomesocket() |> subscribe_and_join(MyChannel, "my_topic")orsocket("user:id", %{user_id: 13}) |> subscribe_and_join(MyChannel, "my_topic").
- [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
- JavaScript client bug fixes
- Pass socket params on reconnect
See these 0.15.x to 0.16.0 upgrade instructions to bring your existing apps up to speed.
-
Enhancements
- [Brunch] No longer ship with
sass-brunchdependency - [Endpoint] Add
force_sslsupport - [Mix] Allow
phoenix.gen.*tasks templates to be customized by the target application by placing copies atpriv/template/phoenix.gen.* - [Mix] Support
mix phoenix.gen.model Comment comment post_id:references:posts - [Mix] Add
mix phoenix.gen.secret - [Router] Provide
put_secure_browser_headers/2and use it by default in the browser pipeline - [Socket] Automatically check origins on socket transports
- [Token] Add
Phoenix.Tokenfor easy signing and verification of tokens
- [Brunch] No longer ship with
-
Bug fixes
- [Cowboy] Ensure we print proper URL when starting the server with both http and https
- [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
-
Backward incompatible changes
- [Controller]
jsonp/3function has been removed in favor of theplug :allow_jsonp - [Controller]
controller_template/1has been renamed toview_template/1 - [HTML] Use
phoenix_html ~> 2.0which includes its ownphoenix_html.jsversion - [Socket]
:originstransport option has been renamed to:check_origin - [View]
render_oneandrender_manyno longer inflect the view module from the model in favor of explicitly passing the view
- [Controller]
-
JavaScript client backwards incompatible changes
- Socket params are now passed to
socket.connect()instead of an option on the constructor. - Socket params are no longer merged as default params for channel params. Use
connect/2on the server to wire up default channel assigns. - Socket
chanhas been renamed tochannel, for examplesocket.channel("some:topic")
- Socket params are now passed to
See these 0.14.x to 0.15.0 upgrade instructions to bring your existing apps up to speed.
-
Enhancements
- [Socket] Introduce
Phoenix.Socketbehaviour that allows socket authentication, termination, and default channel socket assigns - [PubSub] Use ETS dispatch table for increased broadcast performance
- [Channel] Use event intercept for increased broadcast performance
- [Socket] Introduce
-
Backward incompatible changes
- [Router] channel routes are now defined on a socket handler module instead of the Router
- [Router]
socketmounts have been moved from the Router to the Endpoint - [Channel]
handle_outcallbacks now require explicit event intercept for callback to be invoked, withPhoenix.Channel.intercept/1 - [Transports] WebSocket and LongPoll transport configuration has been moved from mix config to the UserSocket
-
JavaScript client backwards incompatible changes
Phoenix.LongPollerhas been renamed toPhoenix.LongPoll- A new client version is required to accommodate server changes
See these 0.13.x to 0.14.0 upgrade instructions to bring your existing apps up to speed.
-
Enhancements
- [Phoenix.HTML] Update to phoenix_html 1.1.0 which raises on missing assigns
- [Controller] Add
jsonp/2for handling JSONP responses - [Channel] Enhance logging with join information
- [Router] Add
forwardmacro to forward a requests to a Plug, invoking the pipeline
-
Javascript client enhancements
- Add socket params to apply default, overridable params to all channel params.
- Enchance logging
-
Bug fixes
- [Channel] Fix xdomain content type not being treated as JSON requests
-
Javascript client backwards incompatible changes
-
loggeroption toPhoenix.Socket, now uses three arguments, ie:logger: (kind, msg, data) => { console.log(${kind}: ${msg}, data) }
-
-
Backward incompatible changes
- [Controller]
plug :actionis now called automatically - [Endpoint] The
:formatoption in:render_errorshas been renamed to:default_format - [PubSub.Redis] The Redis PubSub adapter has been extracted into its own project. If using redis, see the project's readme for instructions
- [View] The default template
web/templates/layout/application.html.eexhas been renamed toapp.html.eex
- [Controller]
See these 0.13.0 to 0.13.1 upgrade instructions to bring your existing apps up to speed.
- Enhancements
- [Channel] Add
phoenix.new.channel Channel topic - [Channel] Add
Phoenix.ChannelCase - [Controller] Assert changes in the repository on generated controller tests
- [Endpoint] Add
static_urlto endpoint to configure host, port and more for static urls - [phoenix.new] Generate a channel case for new apps
- [phoenix.new] Improve installation workflow by asking to install and fetch dependencies once
- [phoenix.new] Add
errors_on/1to generated model case
- [Channel] Add
See these 0.12.x to 0.13.0 upgrade instructions to bring your existing apps up to speed.
-
Enhancements
- [Channel] Allow router helpers to work in channels by passing a socket (instead of connection), for example:
user_path(socket, :index) - [Channel] Support replies in
join/3 - [HTML]
Phoenix.HTMLhas been extracted to its own project. You need to explicitly depend on it by adding{:phoenix_html, "~> 1.0"}todepsin yourmix.exsfile - [HTML]
safe/1in views is deprecated in favor ofraw/1 - [Generators] Allow
belongs_toin model generator which supports associations and indexes
- [Channel] Allow router helpers to work in channels by passing a socket (instead of connection), for example:
-
Bug fixes
- [HTML]
selectno longer inverses the key and values in the given options - [phoenix.new] Do not run
deps.getif there is no Hex
- [HTML]
-
Backward incompatible changes
- [Channel] To refuse joining a channel,
join/3now requires{:error, reason}
- [Channel] To refuse joining a channel,
-
Javascript client backward incompatible changes
-
channel instances are now created from the
socket -
channel joins are now called explicitly off channel instances
-
channel onClose now only triggered on explicit client
leaveor server:stop -
Examples:
let socket = new Phoenix.Socket("/ws") let chan = socket.chan("rooms:123", {}) chan.join().receive("ok", ({resp} => ...).receive("error", ({reason}) => ...)
-
See these 0.11.x to 0.12.0 upgrade instructions to bring your existing apps up to speed.
-
Enhancements
- [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 - [Controller] Support
:namespaceoption in controllers in order to use proper layout in namespaced applications - [Controller] Add
controller_template/1to lookup the template rendered from the controller - [Generators] Add
phoenix.gen.json - [Generators] Allow models to be skipped on
phoenix.gen.jsonandphoenix.gen.htmlgenerators - [Generators] Generate test files in
phoenix.gen.html,phoenix.gen.jsonandphoenix.gen.model - [HTML] Add
search_input/3,telephone_input/3,url_input/3andrange_input/3toPhoenix.HTML.Form - [Installer] Add the generated
config/prod.secret.exsfile to.gitignoreby default - [Static] Add a
mix phoenix.digesttask to run during deploys to generate digest filenames and gzip static files. A new configuration calledcache_static_manifestwas 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 - [Test] Add
html_response/2,json_response/2,text_response/2andresponse/2to aid connection-based testing - [View] Add
render_existing/3to render a template only if it exists without raising an error - [View] Add
render_many/4andrender_one/4to make it easier to render collection and optional data respctivelly
- [Channel] Leaving the channel or closing the client will now trigger terminate on the channel, regardless of traping exits, with reasons
-
Bug fixes
- [Channel] Ensure channels are terminated when WebSocket and LongPoller transports exit normally
- [Installer] Declare missing applications in generated phoenix.new app
- [Installer] No longer generate encryption salt in generated phoenix.new app
- [Installer] Generate proper credentials in phoenix.new for different databases
- [Mix] Ensure the serve endpoints configuration is persistent
- [Router] Ensure URL helpers know how to call
to_paramon query parameters
See these 0.10.x to 0.11.0 upgrade instructions to bring your existing apps up to speed.
-
Javascript client enhancements
- Joins are now synchronous, removing the prior issues of client race conditions
- Events can now be replied to from the server, for request/response style messaging
- Clients can now detect and react to individual channel errors and terminations
-
Javascript client backward incompatible changes
- The
Socketinstance no long connects automatically. You must explicitly callconnect() -
close()has been renamed todisconnect() -
sendhas been renamed topushto unify client and server messaging commands - The
joinAPI has changed to use synchronous messaging. Check the upgrade guide for details
- The
-
Backwards incompatible changes
-
[Generator]
mix phoenix.gen.resourcerenamed tomix phoenix.gen.html -
[Channel]
replyhas been renamed topushto better signify we are only push a message down the socket, not replying to a specific request -
[Channel] The return signatures for
handle_in/3andhandle_out/3have changed, ie:handle_in(event :: String.t, msg :: map, Socket.t) :: {:noreply, Socket.t} | {:reply, {status :: atom, response :: map}, Socket.t} | {:reply, status :: atom, Socket.t} | {:stop, reason :: term, Socket.t} | {:stop, reason :: term, reply :: {status :: atom, response :: map}, Socket.t} | {:stop, reason :: term, reply :: status :: atom, Socket.t} handle_out(event :: String.t, msg :: map, Socket.t) :: {:ok, Socket.t} | {:noreply, Socket.t} | {:error, reason :: term, Socket.t} | {:stop, reason :: term, Socket.t} -
[Channel] The
leave/2callback has been removed. If you need to cleanup/teardown when a client disconnects, trap exits and handle interminate/2, ie:def join(topic, auth_msg, socket) do Process.flag(:trap_exit, true) {:ok, socket} end def terminate({:shutdown, :client_left}, socket) do # client left intentionally end def terminate(reason, socket) do # terminating for another reason (connection drop, crash, etc) end -
[HTML]
use Phoenix.HTMLno longer imports controller functions. You must addimport Phoenix.Controller, only: [get_flash: 2]manually to your views or yourweb.ex -
[Endpoint] Code reloader must now be configured in your endpoint instead of Phoenix. Therefore, upgrade your
config/dev.exsreplacingconfig :phoenix, :code_reloader, trueby
config :your_app, Your.Endpoint, code_reloader: true -
[Endpoint] Live reloader is now a dependency instead of being shipped with Phoenix. Please add
{:phoenix_live_reload, "~> 0.3"}to your dependencies -
[Endpoint] The
live_reloadconfiguration has changed to allow a:urloption and work with:patternsinstead of paths:config :your_app, Your.Endpoint, code_reloader: true, live_reload: [ url: "ws://localhost:4000", patterns: [~r{priv/static/.*(js|css|png|jpeg|jpg|gif)$}, ~r{web/views/.*(ex)$}, ~r{web/templates/.*(eex)$}]] -
[Endpoint] Code and live reloader must now be explicitly plugged in your endpoint. Wrap them inside
lib/your_app/endpoint.exin acode_reloading?block:if code_reloading? do plug Phoenix.LiveReloader plug Phoenix.CodeReloader end
-
-
Enhancements
- [Endpoint] Allow the default format used when rendering errors to be customized in the
render_viewsconfiguration - [HTML] Add
button/2function toPhoenix.HTML - [HTML] Add
textarea/3function toPhoenix.HTML.Form - [Controller]
render/3andrender/4allows a view to be specified directly.
- [Endpoint] Allow the default format used when rendering errors to be customized in the
-
Bug fixes
- [HTML] Fix out of order hours, minutes and days in date/time select
See these 0.9.x to 0.10.0 upgrade instructions to bring your existing apps up to speed.
-
Enhancements
- [CLI] Make
phoenix.newin sync withmix newby making the project directory optional - [Controller] Add
scrub_params/2which makes it easy to remove and prune blank string values from parameters (usually sent by forms) - [Endpoint] Runtime evaluation of
:portconfiguration is now supported. When given a tuple like{:system, "PORT"}, the port will be referenced fromSystem.get_env("PORT")at runtime as a workaround for releases where environment specific information is loaded only at compile-time - [HTML] Provide
tag/2,content_tag/2andcontent_tag/3helpers to make tag generation easier and safer - [Router] Speed up router compilation
- [CLI] Make
-
Backwards incompatible changes
- [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/0function has been added to controllers - [PubSub] Remove the option
:optionsfrom:pubsub. Just define the options alongside the pubsub configuration - [Pubsub] Require the
:nameoption when configuring a pubsub adapter
- [Plug] Update to Plug 0.10.0 which moves CSRF tokens from cookies back to sessions. To avoid future bumps on the road, a
See these 0.8.x to 0.9.0 upgrade instructions to bring your existing apps up to speed.
-
Enhancements
- [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.
-
Bug fixes
- [Plug] Ensure session and flash are serializable to JSON
-
Backwards incompatible changes
- [PubSub] The new PubSub system requires the adapter's configuration to be added to your Endpoint's mix config.
- [PubSub] The
Phoenix.PubSubAPI now requires a registered server name, iePhoenix.PubSub.broadcast(MyApp.PubSub, "foo:bar", %{baz: :bang}) - [Channel] Channel broadcasts from outside a socket connection now must be called from an Endpoint module directly, ie:
MyApp.Endpoint.broadcast("topic", "event", %{...}) - [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/Controller] The
destroyaction has been renamed todelete, update your controller actions and url builders accordingly
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
: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 moved 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