1. Go to this page and download the library: Download asignua/filament-vat-id library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
asignua / filament-vat-id example snippets
use Asignua\FilamentVatId\VatIdPlugin;
$panel->plugin(VatIdPlugin::make());
use Asignua\FilamentVatId\Enums\TaxIdType;
use Asignua\FilamentVatId\Forms\Components\TaxIdInput;
TaxIdInput::make('vat_number')
->countryField('country') // a sibling field holding the ISO country; or ->country('PL')
->type(TaxIdType::EuVat) // the default
->vies() // verify against a registry on save (network)
->lookup() // "Look up" button
->fill([ // CompanyData path => form state path (relative to the field's container)
'name' => 'company_name',
'address' => 'address',
'regon' => 'regon',
'bankAccounts.0' => 'iban',
]);
use Asignua\FilamentVatId\Contracts\CompanyRegistry;
class MyUkrainianRegistry implements CompanyRegistry
{
public function supports(string $country, TaxIdType $type): bool
{
return $country === 'UA' && $type === TaxIdType::UaEdrpou;
}
public function canVerify(string $country, TaxIdType $type): bool
{
return false; // true only if "not found" really means "does not exist" (then ->vies() uses it too)
}
public function lookup(string $country, TaxIdType $type, string $number): ?CompanyData // null = not found
{
// throw Asignua\FilamentVatId\Exceptions\RegistryUnavailable when the provider cannot answer,
// Asignua\FilamentVatId\Exceptions\NumberNotSupported when it cannot handle this kind of number
}
}
// config/filament-vat-id.php: 'registries' => [..., MyUkrainianRegistry::class]
// or on the panel:
$panel->plugin(VatIdPlugin::make()->registry(new MyUkrainianRegistry));
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.