controllers/ as Stimulus controllers.JavaScript tools you can't live without.
A set of PHP & JavaScript packages to solve every day frontend problems featuring Stimulus and Turbo.
Install it
$ composer require symfony/asset-mapper symfony/stimulus-bundle
-
assets
-
bootstrap.jsStarts Stimulus & registers all files in
-
app.jsYour main JavaScript file. It's job is to import and load all other files.
-
controllers.jsonConfigures 3rd-party Stimulus controllers. This file is automatically updated when you install a UX package.
-
controllersThe home of your custom Stimulus controllers!
-
hello_controller.jsAn example controller. Add it to any element with
data-controller="hello"
-
-
styles
-
app.cssYour main CSS file
-
-
-
package.jsonHolds your node dependencies, most importantly Stimulus & Webpack Encore.
-
webpack.config.jsConfiguration file for Webpack Encore: the tool that processes and combines all of your CSS and JS files.
Stimulus Controllers
Write custom JavaScript inside Stimulus Controllers
Read full Documentation<div data-controller="markdown">
<textarea
data-markdown-target="input"
data-action="markdown#render"
>Writing _JavaScript_ is... a **dream** with Stimulus 🤩</textarea>
<div data-markdown-target="preview">
<small><- Write something in the textarea!</small>
</div>
</div>
import { Controller } from '@hotwired/stimulus';
import snarkdown from 'snarkdown';
/* stimulusFetch: 'lazy' */
export default class extends Controller {
static targets = ['input', 'preview'];
render(event) {
const rendered = snarkdown(this.inputTarget.value);
this.previewTarget.innerHTML = rendered;
}
}
Packages
Install UX Components
Browse all PackagesIcons
Render SVG icons seamlessly from your Twig templates.
Map
Render interactive Maps in PHP with Leaflet or Google Maps.
Twig Components
Create PHP classes that can render themselves
Live Components
Build dynamic interfaces with zero JavaScript
Turbo
Integration with Turbo for single-page-app and real-time experience
Stimulus
Integration with Stimulus for HTML-powered controllers
Toolkit
Collection of components and templates that you can use to build your pages.
Native
Build native mobile apps that wrap your Symfony web application
Autocomplete
Ajax-powered, auto-completable select elements
Translator
Use Symfony's translations in JavaScript
Chart.js
Easy charts with Chart.js
React
Quickly render <React /> components & pass them props.