shaiful/phone-input
最新稳定版本:v1.1.5
Composer 安装命令:
composer require shaiful/phone-input
包简介
A Laravel package for phone input with flags and country codes
README 文档
README
This package is used to use ITL Phone input with laravel livewire
Installation
Add the following into
composer.json:composer require shaiful/phone-inputPublish the vendor files
php artisan vendor:publish --provider="Shaiful\PhoneInput\PhoneInputServiceProvider"Include css tags and js tags into your layout file
{!! phone_input_css() !!} {!! phone_input_js() !!} @stack('scripts)Usage
<x-phone-input model="{livewire_model}" id="{livewire_model}" name="{livewire_model}" class="{any_css_class}" /> <input type="hidden" wire:model.live="country_code">Example
<!-- Livewire Component --> <div> <form wire:submit.prevent="submit"> <x-phone-input model="phone" id="phone" name="phone" class="block w-full rounded-lg border border-gray-300 bg-gray-50 p-2.5 text-sm text-gray-900 focus:border-blue-500 focus:ring-blue-500" /> <input type="hidden" wire:model.live="country_code"> <button type="submit">Submit</button> </form> </div><!-- Livewire Class --> use Livewire\Component;
class PhoneInputComponent extends Component {
public $phone;
public $country_code;
public function submit()
{
// Handle the form submission
$this->validate([
'phone' => 'required',
'country_code' => 'required',
]);
// Process the phone number and country code
}
public function render()
{
return view('livewire.phone-input-component');
}
}
5. If You want to use the input in Spatie Step Wizard, Call this function to reinit on step initialization
init_itl();
统计信息
- 总下载量: 114
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: proprietary
- 更新时间: 2025-01-24