phoenix changelog


Hey there, code wranglers! We've got some exciting updates to share that are sure to make your development journey a smoother and more secure ride. ๐Ÿš€โœจ

  • New feature: Custom Dispatcher for Presence ๐ŸŽ‰
    We've added a shiny new feature that lets you customize the dispatcher module in Phoenix.Presence. This means you can now specify a custom dispatcher when handling presence updates, offering you more flexibility to tailor broadcasting behavior to fit your app's unique needs. Check out the updated tests and examples to see how you can leverage this new capability.

  • Improvement: Secure Your Production Environment ๐Ÿ”’
    Security first! We've enabled :force_ssl by default in the production environment to ensure all your traffic goes through HTTPS. Plus, we've removed the host: nil setting to better protect against spoofing attacks. Your app is now more secure than ever!

  • New feature: Assign Functions in Phoenix.Socket ๐Ÿง™โ€โ™‚๏ธ
    Introducing assign_lazy/3 in Phoenix.Socket! This cool new feature lets you pass a single-argument function to assign/2, allowing for dynamic computation and merging of assigns based on the socket state. More flexibility means more power in your hands!

  • Improvement: Generate Passing Live Tests ๐Ÿงช
    No more test failures when your schema and table names match! We've fixed the live generator so it correctly targets collection item elements using schema.collection. Now, whether your names are the same or different, your tests should pass with flying colors!

  • Improvement: Asset Management Documentation ๐Ÿ“š
    We've polished up the asset management documentation for better clarity and accuracy. This includes clearer instructions on JavaScript dependency imports and npm package installation. We've also highlighted the need to ensure npm install is run during project setups, making your asset management process a breeze.

Happy coding and may your commits be ever in your favor! ๐ŸŒŸ

Included Commits

2025-11-13T13:50:36 See commit

The commit titled "Improve asset management documentation (#6528)" focuses on enhancing the clarity and accuracy of the asset management documentation within the project. It includes modifications to the guides/asset_management.md file, with a total of four changes that refine the language and structure of the instructions related to importing JavaScript dependencies and ensuring proper installation of npm packages.

Key improvements include clearer phrasing of the commands for installing dependencies, specifically highlighting the creation of package.json and package-lock.json files in the assets directory. Additionally, the documentation emphasizes the need to add a specific command in the mix.exs file to ensure that npm install is executed during project checkout or release builds, thereby streamlining the asset management process for developers.

Files changed

  • guides/asset_management.md
2025-11-13T13:52:44 See commit

This commit introduces a feature that allows for the customization of the dispatcher module used in the Phoenix.Presence functionality to handle presence updates in a Phoenix application. Previously, the default dispatcher was Phoenix.Channel.Server, but with this update, developers can specify a custom dispatcher by passing the :dispatcher option when using Phoenix.Presence. This flexibility enables developers to tailor the broadcasting behavior to better suit their application needs, allowing for different handling of presence updates.

The changes include modifications to the lib/phoenix/presence.ex file, where the dispatcher option is integrated into the Phoenix.Presence initialization and broadcasting logic. Additionally, the commit includes updates to the tests in test/phoenix/presence_test.exs to validate the new functionality. A custom dispatcher example is provided, demonstrating how to implement and utilize it within the presence tracking system. This enhancement aims to improve the extensibility and adaptability of presence management in Phoenix applications.

Files changed

  • lib/phoenix/presence.ex
  • test/phoenix/presence_test.exs
2025-11-13T13:57:11 See commit

This commit addresses an issue with the live generator in Phoenix Framework where tests would fail when the schema name and table name were identical. The problem arose because the generated tests incorrectly used schema.table instead of schema.collection to target the collection item elements, leading to errors in test execution. The change ensures that the generated tests now correctly reference schema.collection, allowing for successful test runs regardless of whether the schema and table names are the same or different.

The commit modifies the relevant template files to adjust the stream configuration and element selectors in the generated test files. As a result, various generator calling variations, including those with the same or different names and both default and custom primary key names, should now function as intended without causing test failures. This enhancement improves the usability and reliability of the live generator in the Phoenix Framework, ensuring a smoother development experience.

Files changed

  • priv/templates/phx.gen.live/index.ex
  • priv/templates/phx.gen.live/live_test.exs
2025-11-13T13:58:38 See commit

The recent commit addresses security enhancements for production environments by enabling the :force_ssl configuration by default. This change ensures that all traffic is securely transmitted over HTTPS, which is crucial for protecting user data and preventing spoofing attacks. Additionally, the commit removes the host: nil configuration to further mitigate potential security vulnerabilities.

In the updated configuration files for both single and umbrella applications, the commit specifies the use of SSL and includes settings for HTTP Strict Transport Security (HSTS) by implementing the force_ssl option. This adjustment reinforces the security posture of the applications by ensuring that they only communicate over secure channels, thereby safeguarding against various web-based attacks.

Files changed

  • installer/templates/phx_single/config/prod.exs
  • installer/templates/phx_umbrella/apps/app_name_web/config/prod.exs
2025-11-13T13:58:55 See commit

This commit introduces a new feature to the Phoenix.Socket module by adding the assign_lazy/3 function, which allows the assign/2 function to accept a single-argument function as an argument. This enhancement enables developers to dynamically compute and merge assigns based on the current socket state, thereby increasing the flexibility of how assigns can be handled within a socket. The documentation has been updated to reflect this new capability, providing examples of how to use both keyword lists, maps, and functions for assigning values.

Additionally, the commit includes refactoring of the existing code and updates to the test suite to ensure the new functionality is properly validated. A new test case has been added to confirm that functions passed to assign/2 are executed correctly, demonstrating that the resulting assigns are merged as expected. Overall, these changes enhance the usability and functionality of socket assigns in the Phoenix framework.

Files changed

  • lib/phoenix/socket.ex
  • test/phoenix/socket/socket_test.exs