Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

srushti_kansagara's avatar

recommend the package for showing the country code list in laravel ?

sorry , but I am new to laravel I am making the society management admin dashboard. in this i want to show the country code list with my phone number input field when we insert the society members . can someone recommend me how should i do that or which package is best for this ? thank you in advanced for help .

0 likes
10 replies
Snapey's avatar

please query packagist.org

There are probably several to suit your needs

jayandholariya's avatar
Level 4

You can use the intl-tel-input JavaScript library for adding a country code dropdown to your phone number input field. It’s a widely used and reliable solution that provides an intuitive interface, automatic country detection, formatting, and validation.

for this you have to add two library for css and js

<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/intl-tel-input/17.0.8/css/intlTelInput.min.css" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/intl-tel-input/17.0.8/js/intlTelInput.min.js"></script>

and input filed will be like

<input type="tel" id="phone" name="phone" class="form-control" placeholder="Enter phone number">

and this script use for show country code and mobile number validation

<script>
  const phoneInput = document.querySelector("#phone");
  window.intlTelInput(phoneInput, {
    initialCountry: "auto",
    geoIpLookup: callback => {
      fetch('https://ipinfo.io/json?token=<YOUR_TOKEN>')
        .then(response => response.json())
        .then(data => callback(data.country))
        .catch(() => callback('us'));
    },
    utilsScript: "https://cdnjs.cloudflare.com/ajax/libs/intl-tel-input/17.0.8/js/utils.js",
  });
</script>
2 likes
srushti_kansagara's avatar

@jsanwo64 i have seen many document where clearly written that do not use CDN for production that's why i assume that CDN are not made for production

Jsanwo64's avatar

@srushti_kansagara

When to Use a CDN in Production

  1. Your website or application serves a global audience.

  2. You have a lot of static content (e.g., images, videos, CSS, JavaScript).

  3. You expect high traffic volumes or traffic spikes.

  4. You need to improve website performance and reduce latency.

  5. You want to enhance security and protect against DDoS attacks.

When a CDN Might Not Be Necessary

  1. Your audience is localized, and your origin server is already close to them.

  2. Your application is small, with minimal traffic and static content.

  3. You have strict compliance requirements that prevent using third-party services.

This should answer the purpose of using CDN.

RemiM's avatar

There’s a slight misunderstanding about the use of CDNs in this discussion.

@jayandholariya is referring to using a CDN to load a third-party Javascript library instead of installing it locally via a package manager like NPM or Yarn. Meanwhile, @jsanwo64's answer is correct within its own context—which is about using a CDN to host static assets (such as images, videos, css, and js files) to enhance performance, reduce latency, and improve security.

However, the discussion here isn't about serving static content efficiently, it's about whether to load Javascript libraries from a CDN or install them locally. While both involve CDNs, they address different concerns.

As for @srushti_kansagara's concerns, they are valid. Using a CDN in this case can provide a quick setup, but for larger-scale, production ready applications, it's generally better to use NPM or similar package managers to ensure greater control, security, and optimization.

Snapey's avatar

Please note that Tailwind is the odd one out. Tailwind CDN performs on-the fly compliation of your required CSS classes. It is clearly marked as not for production use, only whilst developing. You may have seen 'not for production' here but this is an outlier and not the same as Javascript static assets which can be happily loaded from a CDN.

Please or to participate in this conversation.