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.7.0
v0.6.2
v0.6.1
v0.6.0
v0.5.0
GUIDES
Modules
Mix
Tasks
API Reference
Modules
Mix Tasks
Changelog for v1.7
Introduction of Verified Routes
phx.new revamp
1.7.20 (2025-02-20)
1.7.19 (2025-01-31)
1.7.18 (2024-12-10)
1.7.17 (2024-12-03)
1.7.16 (2024-12-03)
1.7.15 (2024-12-02)
1.7.14 (2024-06-18)
1.7.13 (2024-06-18)
1.7.12 (2024-04-11)
1.7.11 (2024-02-01)
1.7.10 (2023-11-03)
1.7.9 (2023-10-11)
1.7.8 (2023-10-09)
1.7.7 (2023-07-10)
1.7.6 (2023-06-16)
1.7.5 (2023-06-15)
1.7.4 (2023-06-15)
1.7.3 (2023-05-30)
1.7.2 (2023-03-20)
1.7.1 (2023-03-02)
1.7.0 (2023-02-24)
1.7.0-rc.3 (2023-02-15)
1.7.0-rc.2 (2023-01-13)
1.7.0-rc.1 (2023-01-06)
1.7.0-rc.0 (2022-11-07)
v1.6
Introduction
Overview
Installation
Elixir 1.14 or later
Erlang 24 or later
Phoenix
PostgreSQL
inotify-tools (for Linux users)
Summary
Up and Running
Phoenix Express
Via mix phx.new
Community
Books
Screencasts/Courses
Packages Glossary
Guides
Directory structure
The lib/hello directory
The lib/hello_web directory
The assets directory
Request life-cycle
Adding a new page
From endpoint to views
Another new page
Plug
Function plugs
Module plugs
Where to plug
Plugs as composition
Routing
Examining routes
Resources
Verified Routes
Nested resources
Scoped routes
Pipelines
How to organize my routes?
Forward
Summary
Controllers
Actions
Rendering
New rendering formats
Redirection
Flash messages
Error pages
Components and HEEx
Function components
HEEx
Layouts
CoreComponents
Ecto
Using the schema and migration generator
Repo configuration
The schema
Changesets and validations
Data persistence
Using other databases
Other options
Contexts
Thinking about contexts
Starting with generators
Adding Catalog functions
In-context relationships
Cross-context dependencies
Adding an Orders context
FAQ
JSON and APIs
The JSON API
Rendering JSON
Action fallback
FallbackController and ChangesetJSON
API-only applications
Mix tasks
Phoenix tasks
Ecto tasks
Creating our own Mix task
Telemetry
Overview
The Telemetry supervisor
Telemetry Events
Metrics
Reporters
Phoenix Metrics
Periodic measurements
Libraries using Telemetry
Custom Events
Asset Management
Third-party JS packages
Images, fonts, and external files
Esbuild plugins
Alternative JS build tools
Alternative CSS frameworks
Authentication
mix phx.gen.auth
Getting started
Developer responsibilities
Generated code
More about mix phx.gen.auth
Additional resources
API Authentication
Adding API functions to the context
API authentication plug
Your turn
Real-time
Channels
The Moving Parts
Tying it all together
Using Token Authentication
Fault Tolerance and Reliability Guarantees
Example Application
Presence
Setting up
The Presence generator
Usage With Channels and JavaScript
Usage With LiveView
Testing
Introduction to Testing
Running tests
Understanding test modules
The ConnCase
View tests
Running tests per directory/file
Running tests using tags
Randomization
Concurrency and partitioning
Going further
Testing Contexts
Testing posts
The DataCase
Testing schemas
Testing Controllers
HTML controller tests
JSON controller tests
Testing Channels
Generating channels
The ChannelCase
Subscribe and joining
Testing a synchronous reply
Deployment
Introduction to Deployment
Handling of your application secrets
Compiling your application assets
Starting your server in production
Putting it all together
Community Deployment Guides
Deploying with Releases
What we'll need
Goals
Releases, assemble!
Ecto migrations and custom commands
Containers
Deploying on Gigalixir
What we'll need
Goals
Steps
Initializing Git repository
Installing the Gigalixir CLI
Signing up for Gigalixir
Creating and setting up our Gigalixir application
Making our Project ready for Gigalixir
Provisioning a database
Deploy Time!
Useful Gigalixir Commands
Troubleshooting
Deploying on Fly.io
What we'll need
Goals
Sections
Installing the Fly.io CLI
Sign up for Fly.io
Deploy the app to Fly.io
Extra Fly.io tips
Helpful Fly.io resources
Troubleshooting
Deploying on Heroku
What we'll need
Goals
Limitations
Steps
Initializing Git repository
Signing up for Heroku
Installing the Heroku Toolbelt
Create and Set Up Heroku Application
Making our Project ready for Heroku
Creating Environment Variables in Heroku
Deploy Time!
Deploying to Heroku using the container stack
Useful Heroku Commands
Connecting to your dyno
Troubleshooting
Cheatsheets
Routing cheatsheet
Routing declaration
How-to's
Custom Error Pages
The Error Views
Custom exceptions
Actionable errors
File Uploads
Configuring upload limits
Using SSL
SSL in Development
Force SSL
HSTS
Writing a Channels Client
Overview
Connecting
Message Format
Phoenix
Summary
Functions
json_library/0
plug_init_mode/0
Phoenix.Channel
Sections
Topics & Callbacks
Authorization
Incoming Events
Broadcasts
Replies
Pushes
Intercepting Outgoing Events
Broadcasting to an external topic
Terminate
Exit reasons when stopping a channel
Subscribing to external topics
Hibernation
Shutdown
Logging
Summary
Types
payload/0
reply/0
socket_ref/0
Callbacks
handle_call/3
handle_cast/2
handle_in/3
handle_info/2
handle_out/3
join/3
terminate/2
Functions
broadcast/3
broadcast!/3
broadcast_from/3
broadcast_from!/3
intercept/1
push/3
reply/2
socket_ref/1
Phoenix.Controller
Sections
Connection
Rendering and layouts
Plug pipeline
Controllers are plugs
Summary
Types
layout/0
view/0
Functions
accepts/2
action_fallback/1
action_name/1
allow_jsonp/2
clear_flash/1
controller_module/1
current_path/1
current_path/2
current_url/1
current_url/2
delete_csrf_token/0
endpoint_module/1
fetch_flash/2
get_csrf_token/0
get_flash/1
get_flash/2
get_format/1
html/2
json/2
layout/2
layout_formats/1
merge_flash/2
protect_from_forgery/2
put_flash/3
put_format/2
put_layout/2
put_layout_formats/2
put_new_layout/2
put_new_view/2
put_root_layout/2
put_router_url/2
put_secure_browser_headers/2
put_static_url/2
put_view/2
redirect/2
render/2
render/3
root_layout/2
router_module/1
scrub_params/2
send_download/3
status_message_from_template/1
text/2
view_module/2
view_template/1
Phoenix.Endpoint
Sections
Endpoints
Endpoint configuration
Endpoint API
Summary
Types
event/0
msg/0
topic/0
Callbacks
broadcast/3
broadcast!/3
broadcast_from/4
broadcast_from!/4
config/2
config_change/2
host/0
local_broadcast/3
local_broadcast_from/4
path/1
script_name/0
server_info/1
start_link/1
static_integrity/1
static_lookup/1
static_path/1
static_url/0
struct_url/0
subscribe/2
unsubscribe/1
url/0
Functions
server?/2
socket/3
Phoenix.Flash
Summary
Functions
get/2
Phoenix.Logger
Sections
Instrumentation
Parameter filtering
Dynamic log level
Disabling
Phoenix.Naming
Summary
Functions
camelize/1
camelize/2
humanize/1
resource_name/2
underscore/1
unsuffix/2
Phoenix.Param
Sections
Custom parameters
Summary
Types
t/0
Functions
to_param/1
Phoenix.Presence
Sections
Example Usage
Fetching Presence Information
Using Elixir as a Presence Client
Testing with Presence
Summary
Types
presence/0
presences/0
topic/0
Callbacks
fetch/2
get_by_key/2
handle_metas/4
init/1
list/1
track/3
track/4
untrack/2
untrack/3
update/3
update/4
Phoenix.Router
Sections
Routing
Generating routes
Scopes and Resources
Pipelines and plugs
How to organize my routes?
Summary
Reflection
route_info/4
scoped_alias/2
scoped_path/2
Functions
connect/4
delete/4
forward/4
get/4
head/4
match/5
options/4
patch/4
pipe_through/1
pipeline/2
plug/2
post/4
put/4
resources/2
resources/3
resources/4
routes/1
scope/2
scope/3
scope/4
trace/4
Phoenix.Socket
Sections
Socket Behaviour
Examples
Socket fields
Using options
Garbage collection
Client-server communication
Custom sockets and transports
Custom channels
Summary
Types
t/0
Callbacks
connect/2
connect/3
id/1
Functions
assign/2
assign/3
channel/3
Phoenix.Token
Sections
Example
Usage
Summary
Types
context/0
max_age_opt/0
shared_opt/0
signed_at_opt/0
Functions
decrypt/4
encrypt/4
sign/4
verify/4
Phoenix.VerifiedRoutes
Sections
Options
Usage
Tracking Warnings
Summary
Functions
path/2
path/3
sigil_p/2
static_integrity/2
static_path/2
static_url/2
unverified_path/4
unverified_url/3
url/1
url/2
url/3
Testing
Phoenix.ChannelTest
Sections
Channel testing
Checking side-effects
Leave and close
Summary
Functions
assert_broadcast/3
assert_push/3
assert_reply/4
broadcast_from/3
broadcast_from!/3
close/2
connect/3
join/2
join/3
join/4
leave/1
push/3
refute_broadcast/3
refute_push/3
refute_reply/4
socket/1
socket/4
subscribe_and_join/2
subscribe_and_join/3
subscribe_and_join/4
subscribe_and_join!/2
subscribe_and_join!/3
subscribe_and_join!/4
Phoenix.ConnTest
Sections
Endpoint testing
Controller testing
Views testing
Recycling
Summary
Functions
assert_error_sent/2
build_conn/0
build_conn/3
bypass_through/1
bypass_through/2
bypass_through/3
clear_flash/1
connect/3
delete/3
delete_req_cookie/2
dispatch/5
ensure_recycled/1
fetch_flash/1
get/3
get_flash/1
get_flash/2
head/3
html_response/2
init_test_session/2
json_response/2
options/3
patch/3
path_params/2
post/3
put/3
put_flash/3
put_req_cookie/3
recycle/2
redirected_params/2
redirected_to/2
response/2
response_content_type/2
text_response/2
trace/3
Adapters and Plugs
Phoenix.CodeReloader
Summary
Functions
call/2
init/1
reload/2
reload!/2
sync/0
Phoenix.Endpoint.Cowboy2Adapter
Sections
Endpoint configuration
Custom dispatch options
Summary
Functions
server_info/2
Phoenix.Endpoint.SyncCodeReloadPlug
Summary
Functions
call/2
init/1
Digester
Phoenix.Digester.Compressor
Sections
Example
Summary
Callbacks
compress_file/2
file_extensions/0
Phoenix.Digester.Gzip
Summary
Functions
compress_file/2
file_extensions/0
Socket
Phoenix.Socket.Broadcast
Summary
Types
t/0
Phoenix.Socket.Message
Summary
Types
t/0
Functions
from_map!/1
Phoenix.Socket.Reply
Summary
Types
t/0
Phoenix.Socket.Serializer
Summary
Callbacks
decode!/2
encode!/1
fastlane!/1
Phoenix.Socket.Transport
Sections
Example
Custom transports
Booting
Summary
Types
state/0
Callbacks
child_spec/1
connect/1
drainer_spec/1
handle_control/2
handle_in/2
handle_info/2
init/1
terminate/2
Functions
check_origin/5
check_subprotocols/2
code_reload/3
connect_info/3
transport_log/2
Exceptions
Phoenix.ActionClauseError
Phoenix.MissingParamError
Phoenix.NotAcceptableError
Phoenix.Router.MalformedURIError
Phoenix.Router.NoRouteError
Phoenix.Socket.InvalidMessageError
mix local.phx
mix phx
mix phx.digest
Sections
vsn
mix phx.digest.clean
Sections
Options
mix phx.gen
Sections
CRUD related generators
Summary
Functions
run/1
mix phx.gen.auth
Sections
LiveView vs conventional Controllers & Views
Password hashing
Web namespace
Multiple invocations
Binary ids
Default options
Custom table names
mix phx.gen.cert
Sections
Arguments
mix phx.gen.channel
mix phx.gen.context
Sections
Generating without a schema
table
binary_id
Default options
Skipping prompts
mix phx.gen.embedded
Sections
Attributes
mix phx.gen.html
Sections
Umbrella app configuration
Web namespace
Customizing the context, schema, tables and migrations
mix phx.gen.json
Sections
API Prefix
The context app
Web namespace
Customizing the context, schema, tables and migrations
mix phx.gen.live
Sections
The context app
Web namespace
Customizing the context, schema, tables and migrations
mix phx.gen.notifier
mix phx.gen.presence
mix phx.gen.release
Sections
Docker
Summary
Functions
otp_vsn/0
mix phx.gen.schema
Sections
Contexts
Attributes
table
binary_id
repo
migration_dir
prefix
Default options
UTC timestamps
mix phx.gen.secret
mix phx.gen.socket
mix phx.new
Sections
Options
Installation
Examples
PHX_NEW_CACHE_DIR
mix phx.new.ecto
Sections
Options
Examples
mix phx.new.web
Sections
Examples
mix phx.routes
Sections
Options
Examples
Summary
Functions
get_url_info/2
mix phx.server
Sections
Command line options
Search documentation of Phoenix
Settings
Phoenix.Router.MalformedURIError
exception
(Phoenix v1.7.20)
View Source
Exception raised when the URI is malformed on matching.