Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Phoneformatterbundle Laravel Package

alpixel/phoneformatterbundle

View on GitHub
Deep Wiki
Context7

AlpixelPhoneFormatterBundle

Latest Stable Version

Installation

  • Install the package
composer require 'alpixel/phoneformatterbundle'
  • Update AppKernel.php

    <?php
    // app/AppKernel.php

    // ...
    class AppKernel extends Kernel
    {
        public function registerBundles()
        {
            $bundles = array(
                // ...
                new Alpixel\Bundle\PhoneFormatterBundle\AlpixelPhoneFormatterBundle(),
            );

            // ...
        }

        // ...
    }

Utilisation

Helper

The only helper actually available give you the possibility to reformat and clean a phone number following a pattern.

You can call the helper this way

$number = $this->get('alpixel.helper.phone_formatter')->format($currentNumber, PhoneNumberFormat::NATIONAL, 'DE');

The example above will try to output a national german number from the input you gave.

The format option can be :

AlpixelPhoneNumberFormat::INTERNATIONAL // example "+41 44 668 18 00"
AlpixelPhoneNumberFormat::NATIONAL // example : "044 668 18 00"
AlpixelPhoneNumberFormat::E164 // example : "+41446681800"
AlpixelPhoneNumberFormat::AUTO // Will try to make the best guess from your current locale

The third argument is expecting a two letter country code as FR or DE

Twig extension

The helper is callable via a twig extension like this :

"03 03 03 03 03"|phone_format("INTERNATIONAL", "FR")
"03 03 03 03 03"|phone_format("NATIONAL")
"03 03 03 03 03"|phone_format("AUTO", "CH")
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
elmogy/larafast
xeviant/laravel-paystack
gorilladash/laravel-website-sdk
martialbe/flysystem-oss
chondal/3312client
jeroen-g/flickr
opscale-co/nova-genbi
itsjustvita/laravel-retention
tequilarapido/trackit
gregsphotography/site-builder-filament
cabaoctavio/laravel-query-log
gregsphotography/site-builder-components
io-digital/clickatell
snowsoft/laravel-admin
oxygen/auth
relicsoftware/barakah-payment-gateway
tobya/work-with-composer
equipc/laravel-email-validator
equipc/laravel-email-database-log
adedsec/nova-translated-labels