Phoenix v1.7 requires Elixir v1.11+.
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">Sign 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 >= 1.14.0 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
.
- [Router] Add
Phoenix.VerifiedRoutes
for~p
-based route generation with compile-time verification. - [Router] Support
helpers: false
touse Phoenix.Router
to disable helper generation
- Fix heartbeat being sent after disconnect and causing abnormal disconnects
See the upgrade guide to upgrade from Phoenix 1.5.x.
Phoenix v1.6 requires Elixir v1.9+.
- Add convenience for getting longpoll reference with
getLongPollTransport
- Cancel inflight longpoll requests on canceled longpoll session
- Do not attempt to flush socket buffer when tearing down socket on
replaceTransport
- Add
ping
function to socket
- [phx.gen.release] Fix generated .dockerignore comment
- [phx.gen.release] Fix Ecto check failing to find Ecto in certain cases
- [Endpoint] Add Endpoint init telemetry event
- [Endpoint] Prioritize user :http configuration for ranch to fix inet_backend failing to be respected
- [Logger] Support log_module in router metadata
- [phx.gen.release] Don't handle assets in Docker when directory doesn't exist
- [phx.gen.release] Skip generating migration files when ecto_sql is not installed
- Switch to .mjs files for ESM for better compatibility across build tools
- Fix LongPoll callbacks in JS client causing errors on connection close
- [Endpoint] Fix
check_origin: :conn
failing to match scheme
- [Endpoint] Support
check_origin: :conn
to enforce origin on the connection's host, port, and scheme
- Fix incorrect
phx.gen.release
output
- Add new
phx.gen.release
task for release and docker based deployments - Add
fullsweep_after
option to the websocket transport - Add
:force_watchers
option toPhoenix.Endpoint
for running watchers even when web server is not started
- Fix Endpoint
log: false
failing to disable logging
- Do not attempt to reconnect automatically if client gracefully closes connection
- [phx.new] Fix external flag to esbuild using incorrect syntax
- [phx.new] Add external flag to esbuild for fonts and image path loading
- [phx.gen.auth] No longer set
argon2
as the default hash algorithm forphx.gen.auth
in favor of bcrypt for performance reasons on smaller hardware
- Fix race conditions logging debug duplicate channel joins when no duplicate existed
- Export commonjs modules for backwards compatibility
- [ConnTest] Add
path_params/2
for retrieving router path parameters out of dynamically returned URLs.
- Fix LongPoll transport undefined readyState check
- [mix phx.gen.auth] Validate bcrypt passwords are no longer than 72 bytes
- re-enable
phx.routes
task to support back to back invocations, such as for aliased mix route tasks - [mix phx.gen.html] Remove comma after
for={@changeset}
onform.html.heex
- Fix messages for duplicate topic being dispatched to old channels
- [CodeReloader] Code reloading can now pick up changes to .beam files if they were compiled in a separate OS process than the Phoenix server
- [Controller] Do not create compile-time dependency for
action_fallback
- [Endpoint] Allow custom error response from socket handler
- [Endpoint] Do not require a pubsub server in the socket (only inside channels)
- [mix phx.digest.clean] Add
--all
flag tomix phx.digest.clean
- [mix phx.gen.auth] Add
mix phx.gen.auth
generator - [mix phx.gen.context] Support
enum
types and theredact
option when declaring fields - [mix phx.gen.notifier] A new generator to build notifiers that by default deliver emails
- [mix phx.new] Update
mix phx.new
to require Elixir v1.12 and use the newconfig/runtime.exs
- [mix phx.new] Set
plug_init_mode: :runtime
in generatedconfig/test.exs
- [mix phx.new] Add description to Ecto telemetry metrics
- [mix phx.new] Use
Ecto.Adapters.SQL.Sandbox.start_owner!/2
in generators - this approach provides proper shutdown semantics for apps using LiveView and Presence - [mix phx.new] Add
--install
and--no-install
options tophx.new
- [mix phx.new] Add
--database sqlite3
option tophx.new
- [mix phx.new] Remove usage of Sass
- [mix phx.new] New applications now depend on Swoosh to deliver emails
- [mix phx.new] No longer generate a socket file by default, instead one can run
mix phx.gen.socket
- [mix phx.new] No longer generates a home page using LiveView, instead one can run
mix phx.gen.live
- [mix phx.new] LiveView is now included by default. Passing
--no-live
will comment out lines inapp.js
andEndpoint
- [mix phx.server] Add
--open
flag - [Router] Do not add compile time deps in
pipe_through
- [View] Extracted
Phoenix.View
into its own project to facilitate reuse
- Add new
replaceTransport
function to socket with extendedonError
API to allow simplified LongPoll fallback - Fire each event in a separate task for the LongPoll transport to fix ordering
- Optimize presence syncing
- [Controller] Return normalized paths in
current_path/1
andcurrent_path/2
- [mix phx.gen.live] Fix a bug where tests with
utc_datetime
andboolean
fields did not pass out of the box
- Bind to
beforeunload
instead ofunload
to solve Firefox connection issues - Fix presence onJoin including current metadata in new presence
- [mix compile.phoenix] Adding the
:phoenix
compiler to yourmix.exs
(compilers: [:phoenix] ++ Mix.compilers()
) is no longer required from Phoenix v1.6 forward if you are running on Elixir v1.11. Remove it from yourmix.exs
and you should gain faster compilation times too - [Endpoint] Phoenix now requires Cowboy v2.7+
- [View]
@view_module
and@view_template
are no longer set. UsePhoenix.Controller.view_module/1
andPhoenix.Controller.view_template/1
respectively, or pass explicit assigns fromPhoenix.View.render
.
The CHANGELOG for v1.5 releases can be found in the v1.5 branch.