kematjaya / price-bundle
1.1.7
2023-11-24 07:57 UTC
Requires
- symfony/config: ^5.4
- symfony/dependency-injection: ^5.4
- symfony/event-dispatcher: ^5.4
- symfony/form: ^5.4
- symfony/http-kernel: ^5.4
- symfony/intl: ^5.4
- symfony/yaml: ^5.4
- twig/twig: ^3.3
Requires (Dev)
- phpunit/phpunit: ^9.5
- symfony/browser-kit: ^5.4
- symfony/framework-bundle: ^5.4
- symfony/var-dumper: ^5.4
README
Symfony 4 的价格类型扩展
-
安装
composer require kematjaya/price-bundle
-
添加到 bundles.php
Kematjaya\PriceBundle\PriceBundle::class => ["all" => true]
-
添加到 twig.yaml
twig: form_themes: .... - '@Price/bootstrap_5_price_layout.html.twig' ## for bootstrap 5 - '@Price/bootstrap_4_price_layout.html.twig' ## for bootstrap 4 - '@Price/bootstrap_3_price_layout.html.twig' ## for bootstrap 3 ....
-
使用 3.1. 表单
... use Kematjaya\PriceBundle\Type\PriceType; ... $builder->add("price", PriceType::class); ...
3.2. Twig
- 数字读法
{{ terbilang(1000) }} // seribu {{ terbilang(40000) }} // empat puluh ribu
- 价格格式
{{ price(1000) }} // IDR 1,000 {{ price(1000.22) }} // IDR 1,000.22 {{ price(4500) }} // IDR 4,500