shaiful/phone-input 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

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

  1. Add the following into composer.json:

    composer require shaiful/phone-input
    
  2. Publish the vendor files

    php artisan vendor:publish --provider="Shaiful\PhoneInput\PhoneInputServiceProvider"
    
  3. Include css tags and js tags into your layout file

    {!! phone_input_css() !!}
    {!! phone_input_js() !!}
    @stack('scripts)
    
  4. 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">
    
  5. 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();


统计信息

  • 总下载量: 468
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: proprietary
  • 更新时间: 2025-01-24

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固