Requirements
Before installing Phlex, ensure your environment meets these requirements:Ruby Version: 3.2 or higher requiredCheck your Ruby version:
Installation Methods
- Bundler
- gem install
Framework Integration
Ruby on Rails
Sinatra
Hanami
Verify Installation
Create a simple test file to verify Phlex is working:test_phlex.rb
Installation successful! Phlex is ready to use.
Dependencies
Phlex automatically installs these dependencies:zeitwerk (~> 2.7)
zeitwerk (~> 2.7)
Provides efficient autoloading for Phlex’s internal modules and your component classes.Learn more about Zeitwerk
refract (~> 1.0)
refract (~> 1.0)
Enables efficient rendering and buffer management for optimal performance.
Troubleshooting
Ruby version error
Ruby version error
Error:
required_ruby_version (>= 3.2) not satisfiedSolution: Upgrade Ruby to version 3.2 or higher:LoadError: cannot load such file
LoadError: cannot load such file
Error:
LoadError: cannot load such file -- phlexSolution: Make sure you’ve run bundle install or the gem is in your load path:Autoloading issues in Rails
Autoloading issues in Rails
Problem: Components not found or not reloading in developmentSolution: Ensure your components directory is in the autoload path:
config/application.rb
Next Steps
Build Your First Component
Now that Phlex is installed, create your first component and learn the core concepts.