mhunesi / yii2-cardjs
Yii2 Card JS Asset Bundle
Installs: 68
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/mhunesi/yii2-cardjs
Requires
- bower-asset/card: ~2.5.4
- yiisoft/yii2: ~2.0.0
This package is auto-updated.
Last update: 2025-09-29 02:44:02 UTC
README
Yii2 Card JS Widget
Card JS https://github.com/jessepollak/card
Installation
The preferred way to install this extension is through composer.
Either run
composer require --prefer-dist mhunesi/yii2-cardjs "*"
or add
"mhunesi/yii2-cardjs": "*"
to the require section of your composer.json file.
Usage
Once the extension is installed, simply use it in your code by :
<div class="row">
<div class="col-md-6">
<form class="card-form">
<input type="text" name="number">
<input name="name"/>
<input name="expiry"/>
<input name="cvc"/>
</form>
</div>
<div class="col-md-6">
<?= \mhunesi\cardjs\CardJs::widget([
'clientOptions' => [
'form' => '.card-form',
'placeholders' => [
'number' => '**** **** **** ****',
'name' => 'Name Lastname',
'expiry' => '**/**',
'cvc' => '***'
],
'formSelectors' => [
'numberInput' => 'input[name="number"]',
'expiryInput' => 'input[name="expiry"]',
'cvcInput' => 'input[name="cvc"]',
'nameInput' => 'input[name="name"]'
],
'formatting' => true,
'debug' => YII_ENV_DEV
]
]) ?>
</div>
</div>