yaroslavche / symfony-ux-flatpickr
Flatpickr integration for Symfony
Installs: 69
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 1
Open Issues: 0
Type:symfony-bundle
Requires
- php: >=7.4.5
- ext-json: *
- symfony/config: ^5.4|^6.3
- symfony/dependency-injection: ^5.4|^6.3
- symfony/form: ^5.4|^6.3
- symfony/http-kernel: ^5.4|^6.3
Requires (Dev)
- phpunit/phpunit: ^9.5
- symfony/framework-bundle: ^5.4|^6.3
- symfony/twig-bundle: ^5.4|^6.3
- symfony/var-dumper: ^5.4|^6.3
This package is auto-updated.
Last update: 2024-10-13 22:04:02 UTC
README
$ composer require yaroslavche/symfony-ux-flatpickr
$ yarn install --force
$ yarn encore dev
# src/Controller/SomeController.php # ... use Yaroslavche\Symfony\UX\Flatpickr\Form\Type\FlatpickrDateTimeType; use Yaroslavche\Symfony\UX\Flatpickr\Form\Type\FlatpickrDateType; class SomeController extends AbstractController { /** * @Route("/", name="home") * @param Request $request * @return Response */ public function index(Request $request): Response { $form = $this->createFormBuilder() ->add('date', FlatpickrDateType::class) ->add('datetime', FlatpickrDateTimeType::class) ->add('send', SubmitType::class) ->getForm(); $form->handleRequest($request); if ($form->isSubmitted() && $form->isValid()) { $data = $form->getData(); dd($data); } return $this->renderForm('template.html.twig', ['form' => $form]); } }
Installation without recipe
# assets/controllers.json "controllers": { "@yaroslavche/symfony-ux-flatpickr": { "flatpickr": { "enabled": true, "fetch": "eager" } } },
# package.json "devDependencies": { # ... "@yaroslavche/symfony-ux-flatpickr": "file:vendor/yaroslavche/symfony-ux-flatpickr/src/Resources/assets", "flatpickr": "^4.6.13" }
Make sure, that you have in package.json
"@symfony/stimulus-bridge": "^3.2.2",
"@symfony/webpack-encore": "^4.0.0",