2024-10
-
PHP 8.3
-
Symfony 7.1
-
Symfony AssetMapper ( Simple, Modern CSS & JS Management )
-
Twig template engine
-
Twig base component ( ux-twig-component )
-
Stimulus js ( for live components with twig)
-
Apache web server ( with Docker)
this project show:
Live components builds on top of the TwigComponent library to give you the power to automatically update your Twig components on the frontend as the user interacts with them. Inspired by Livewire and Phoenix LiveView.
-- Symfony Docs
Examples in this project:
-
Counter
-
Live search
-
Markdown preview
-
Simple form
-
Validation form
composer create-project symfony/skeleton:"7.1.*" my_project_directoryor on current dir / folder
composer create-project symfony/skeleton:"7.1.*" ./composer require symfony/apache-packthis install / copy .htaccess config file
composer require --dev symfony/maker-bundleas recipe, alias - generator, make, maker, maker-bundle, makerbundle
composer require makelist of others recipes:
composer require symfony/twig-bundleas recipe, alias - twig-bundle, twigbundle
composer require twig-bundlecomposer reqire symfony/profiler-packas recipe, alias - web-profiler-bundle, webprofilerbundle
composer require webprofilerbundleThe AssetMapper component lets you write modern JavaScript and CSS without the complexity of using a bundler. Browsers already support many modern JavaScript features like the import statement and ES6 classes. And the HTTP/2 protocol means that combining your assets to reduce HTTP connections is no longer urgent. This component is a light layer that helps serve your files directly to the browser.
-- Symfony Docs
composer require symfony/asset-mapper symfony/asset symfony/twig-packTwig components give you the power to bind an object to a template, making it easier to render and re-use small template "units" - like an "alert", markup for a modal, or a category sidebar
-- Symfony docs
composer require symfony/ux-twig-componentas recipe, alias - ux-twig-component, uxtwigcomponent
composer require ux-twig-componentcomposer require symfony/ux-live-componentor as recipe, alias - ux-live-component, uxlivecomponent
composer require ux-live-componentWhen you trigger an action, a POST request is sent that contains a custom Accept header. This header is automatically populated and validated. In other words… you get CSRF protection without any work thanks to same-origin / CORS policies implemented by browsers.
composer require symfony/security-csrfAnd activate to apply on headers
# config/packages/framework.yaml
framework:
# ...
csrf_protection: truecomposer require twig/markdown-extra league/commonmarkexample of use:
as a simple filter:
{{ '# MD'|markdown_to_html }}or
{% apply markdown_to_html %}
Welcome {{ email.toName }}!
===========================
You signed up to our site using the following email:
`{{ email.to[0].address }}`
[Activate your account]({{ url('...') }})
{% endapply %}composer require symfony/validatoras recipe, validation, validator:
composer require validator
