See the upgrade guide to upgrade from Phoenix 1.6.x.
Phoenix v1.7 requires Elixir v1.11+ & Erlang v22.1+.
Phoenix 1.7 includes a new Phoenix.VerifiedRoutes
feature which provides ~p
for route generation with compile-time verification.
Use of the sigil_p
macro allows paths and URLs throughout your
application to be compile-time verified against your Phoenix router(s).
For example the following path and URL usages:
<.link href={~p"/sessions/new"} method="post">Log in</.link>
redirect(to: url(~p"/posts/#{post}"))
Will be verified against your standard Phoenix.Router
definitions:
get "/posts/:post_id", PostController, :show
post "/sessions/new", SessionController, :create
Unmatched routes will issue compiler warnings:
warning: no route path for AppWeb.Router matches "/postz/#{post}"
lib/app_web/controllers/post_controller.ex:100: AppWeb.PostController.show/2
Note: Elixir v1.14+ is required for comprehensive warnings. Older versions will work properly and warn on new compilations, but changes to the router file will not issue new warnings.
This feature replaces the Helpers
module generated in your Phoenix router, but helpers
will continue to work and be generated. You can disable router helpers by passing the
helpers: false
option to use Phoenix.Router
.
The phx.new
application generator has been improved to rely on function components for
both Controller and LiveView rendering, ultimately simplifying the rendering stack of
Phoenix applications and providing better reuse.
New applications come with a collection of well-documented and accessible core components,
styled with Tailwind CSS by default. You can opt-out of Tailwind CSS with the --no-tailwind
flag (the Tailwind CSS classes are kept in the generated components as reference for
future styling).
- Use new interpolation syntax in generators
- Update gettext in generators to 0.26
- Use LiveView 1.0.0 for newly generated applications
- Fix required Elixir version in mix.exs
- Support phoenixframework.org installer
- Revert "Add
follow_redirect/2
to Phoenix.ConnTest" (#5797) as this conflicts withfollow_redirect/2
in LiveView, which is imported with ConnTest by default
- Fix Elixir 1.17 warning in Cowboy2Adapter
- Fix verified routes emitting diagnostics without file and position
- Fix error when
sessionStorage
is not available on global namespace
- Add
follow_redirect/2
to Phoenix.ConnTest - Use LiveView 1.0.0-rc for newly generated applications
- Use new
Phoenix.Component.used_input?
for form errors in generatedcore_components.ex
- Allow
mix ecto.setup
from the umbrella root - Bump Endpoint static cache manifest on
config_change
callback
- Fix all unjoined channels from being removed from the socket when channel leave is called on any single unjoined channel instance
-
[phx.gen.auth] Add enhanced session fixation protection. For applications whichs previously used
phx.gen.auth
, the following line can be added to therenew_session
function in the auth module:defp renew_session(conn) do + delete_csrf_token() conn |> configure_session(renew: true) |> clear_session()
Note: because the session id is in a http-only cookie by default, the only way to perform this attack prior to this change is if your application was already vulnerable to an XSS attack, which itself grants more escalated "privileges” than the CSRF fixation.
- Only memorize longpoll fallback for browser session if WebSocket never had a successful connection
- [phx.new] Default to the Bandit webserver for newly generated applications
- [phx.new] Enable longpoll transport by default and auto fallback when websocket fails for newly generated applications
- Support new
longPollFallbackMs
option to auto fallback when websocket fails to connect - Support new
debug
option to enable verbose logging
- Deprecate the
c:init/2
callback in endpoints in favor ofconfig/runtime.exs
or in favor of{Phoenix.Endpoint, options}
- [phx.new] Fix
CoreComponents.flash
generating incorrect id's causing flash messages to fail to be closed when clicked
- [Phoenix.Endpoint] Support dynamic port for
Endpoint.url/0
- [Phoenix.CodeReloader] - Fix error in code reloader causing compilation errors
- [phx.new] – fix LiveView debug heex configuration being generated when
--no-html
pas passed
- [Phoenix.ChannelTest] Stringify lists when pushing data
- [Phoenix.Controller] Fix filename when sending downloads with non-ascii names
- [Phoenix.CodeReloader] Remove duplicate warnings on recent Elixir versions
- [Phoenix.CodeReloader] Do not crash code reloader if file information is missing from diagnostic
- [Phoenix.Logger] Do not crash when status is atom
- [phx.gen.release] Fix
mix phx.gen.release --docker
failing with:http_util
error on Elixir v1.15 - [phx.gen.*] Skip map inputs in generated forms as there is no trivial matching input
- [phx.new] Fix tailwind/esbuild config and paths in umbrella projects
- [phx.new] Do not render
th
for actions if actions are empty
- [Phoenix] Allow latest
plug_crypto
- [Phoenix.Endpoint] Support dynamic socket drainer configuration
- [Phoenix.Logger] Change socket serializer/version logs to warning
- [Phoenix.VerifiedRoutes] Add support for static resources with fragments in
~p
- [phx.gen.schema] Support
--repo
and--migration-dir
flags - [phx.new] Allow
<.input type="checkbox">
withoutvalue
attr in core components - [phx.new] Allow UTC datetimes in the generators
- [phx.new] Automatically migrate when release starts when using sqlite 3
- [phx.new] Allow ID to be assigned in flash component
- [phx.new] Add
--adapter
flag for generating application with bandit - [phx.new] Include DNSCluster for simple clustering
- [phx.routes] Support
--method
option
- Support incoming binary payloads to channels over longpoll transport
- Support websock_adapter 0.5.3
- Allow using Phoenix.ChannelTest socket/connect in another process
- Fix LongPoll error when draining connections
- Fix the WebSocket draining sending incorrect close code when draining causing LiveViews to reload the page instead of reconnecting
- Use LiveView 0.19 for new apps
- Fix compilation error page on plug debugger showing obscure error when app fails to compile
- Fix warnings being printed twice in route verification
- [Endpoint] Add socket draining for batched and orchestrated Channel/LiveView socket shutdown
- [code reloader] Improve the compilation error page to remove horizontal scrolling and include all warnings and errors from compilation
- [phx.new] Support the
--no-tailwind
and--no-esbuild
flags - [phx.new] Move heroicons to assets/vendor
- [phx.new] Simplify core modal to use the new JS.exec instruction to reduce footprint
- [sockets] Allow custom csrf_token_keys in WebSockets
- [phx.new] Embed heroicons in app.css bundle to optimize usage
- Fix race conditions in the longpoll transport by batching messages
- Use stream based collections for
phx.gen.live
generators - Update
phx.gen.live
generators to usePhoenix.Component.to_form
- [Router] Fix routing bug causing incorrect matching order on similar routes
- [phx.new] Fix installation hanging in some cases
- Raise if using verified routes outside of functions
- Add tailwind.install/esbuild.install to mix setup
- [Presence] fix task shutdown match causing occasional presence errors
- [VerifiedRoutes] Fix expansion causing more compile-time deps than necessary
- [phx.gen.auth] Add password inputs to password reset edit form
- [phx.gen.embedded] Fixes missing :references generation to phx.gen.embedded
- Fix textarea rendering in core components
- Halt all sockets on intercept to fix longpoll response already sent error
Phoenix.Controller.get_flash
has been deprecated in favor of the newPhoenix.Flash
module, which provides unified flash access
- [Router] Add
Phoenix.VerifiedRoutes
for~p
-based route generation with compile-time verification. - [Router] Support
helpers: false
touse Phoenix.Router
to disable helper generation - [Router] Add
--info [url]
switch tophx.routes
to get route information about a url/path - [Flash] Add
Phoenix.Flash
for unfied flash access
- Fix heartbeat being sent after disconnect and causing abnormal disconnects
The CHANGELOG for v1.6 releases can be found in the v1.6 branch.