phone number standards

Sent logo
Sent TeamMar 8, 2026 / phone number standards / Article

San Marino Country Code +378: Phone Number Format & Validation Guide

Complete guide to calling San Marino with +378 country code. Learn phone number formats, validation rules, area codes (0549), and implementation tips for developers and businesses.

San Marino Phone Numbers: Format, Area Code & Validation Guide

The San Marino country code is +378. San Marino phone numbers follow an 8-digit format with the 0549 area code for landlines. This comprehensive guide covers everything you need to know about calling San Marino – phone number formats, validation rules, the +378 vs +39 dialing situation, and integration best practices for developers implementing San Marino telecommunications.

Quick Reference: How to Call San Marino

Essential information for calling San Marino internationally:

  • San Marino Country Code: +378 (official)
  • International Dialing Prefix: 00 (when not using +)
  • Landline Area Code: 0549 (all San Marino landlines)
  • Mobile Number Prefix: 6XXX
  • Phone Number Length: 8 digits (after country code)
  • Alternative Dialing: Landlines also reachable via Italy's +39 country code (legacy format: +39 0549 XXXX)
  • Historical Note: Until 1996, San Marino used the Italian telephone numbering plan with area code 0549. The +378 country code was adopted in 1996, but landlines remain reachable via both +378 and the Italian country code +39 (as +39 0549 XXXX) due to bilateral dialing arrangements. [Source: ITU]

Understanding San Marino's Telecommunications System

San Marino operates an advanced telecommunications infrastructure. The Information and Communication Technology Authority (ICT Authority) oversees a state-of-the-art digital network with comprehensive Fiber to the Home (FTTH) coverage. This small nation has pioneered new technologies, often outpacing larger countries.

Digital Transformation and the ICT Authority

San Marino's compact size (61 km²) enables swift deployment of cutting-edge technologies. Key advancements include:

  • Complete FTTH Network Coverage: Over 50% of users connected via fiber with planned copper (DSL) phase-out by 2027; average fixed internet speed: 96.8 Mbps [Source: Digital Watch Observatory]
  • Advanced 5G Mobile Network: First European country to achieve full 5G coverage (~99% of territory by late 2018); 3G and LTE/4G coverage: 99% of population [Sources: ITU 5G Country Profile, Digital Watch]
  • Digital-First Government Services: E-Government Development Index (EGDI) score: 0.655; Telecommunication Infrastructure Index: 0.94 [Source: Digital Watch Observatory]
  • Smart City Initiatives: Leverages modern telecommunications to enhance urban living with focus on banking, tourism, industry 4.0, and public security

The ICT Authority, established by Delegated Decree no. 146/2018 (ratified by Delegated Decree no. 109 on 30 August 2018), regulates and supervises this landscape, ensuring continued development and security. [Source: San Marino Ministry of Foreign Affairs] This provides a stable, well-regulated environment for telecommunications development.

San Marino Phone Number Format: How Numbers Are Structured

San Marino's telephone system adheres to International Telecommunication Union (ITU-T) recommendations, ensuring global compatibility and simplifying integration with international systems.

General Number Format

San Marino phone numbers use 6–10 digits, preceded by the country code:

+378 XXXX XXXX

Where:

  • +378 is the country code for San Marino.
  • XXXX XXXX represents the subscriber number (typically 8 digits for standard services).

Service-Specific Number Formats

San Marino uses distinct prefixes to differentiate service types. Understand these distinctions to ensure accurate number processing.

1. Geographic Numbers (Landlines):

Format: +378 0549 XXXX Example: +378 0549 1234

All San Marino landlines use the 0549 area code – the sole geographic prefix for landline numbers.

Dual Country Code Access: Due to historical ties (San Marino used the Italian numbering plan until 1996), landlines can be reached using either:

  • Recommended: +378 0549 XXXX (official San Marino country code)
  • Legacy compatible: +39 0549 XXXX (via Italian country code +39)

When implementing phone number handlers, normalize to +378 for storage while accepting both formats in user input. The +39 0549 prefix maintains legacy system compatibility and cross-border convenience. [Source: Wikipedia]

2. Mobile Numbers:

Format: +378 6XXX XXXX Example: +378 6123 4567

Mobile numbers start with 6. Major mobile operators include San Marino Telecom (SMT), Telefonia Mobile Sammarinese (TMS), and Telecom Italia (TIM) San Marino. [Source: ITU 5G Country Profile]

3. IP Telephony Services:

Format: +378 5XXX XXXX Example: +378 5123 4567

Numbers starting with 5 are used for VoIP and IP telephony services. [Source: ITU National Numbering Plan]

4. Premium Rate Services:

Format: +378 7XXX XXXX Example: +378 7890 1234

Premium rate services start with 7. These numbers typically have specialized services or higher call charges.

Compliance Warning: Premium rate services often incur significantly higher costs than standard calls. Businesses using premium numbers must:

  • Clearly disclose pricing before connection
  • Obtain explicit user consent
  • Comply with ICT Authority regulations on premium service advertising
  • Provide alternative contact methods for general inquiries

Premium services typically cost €0.50–€3.00 per minute or connection. Consult current ICT Authority guidelines for compliance requirements.

Phone Number Validation: Implementation Guidelines for Developers

This section provides practical guidance on validating, formatting, and handling San Marino phone numbers in your applications.

Validate San Marino Phone Numbers

Validate user input to ensure data integrity and correct phone number handling.

Using libphonenumber (Recommended)

For production applications, use Google's libphonenumber library, the industry-standard tool for international phone number validation, formatting, and parsing:

JavaScript Example:

javascript
import { parsePhoneNumber } from 'libphonenumber-js';

function validateSanMarinoNumber(input) {
  try {
    const phoneNumber = parsePhoneNumber(input, 'SM');

    return {
      valid: phoneNumber.isValid(),
      formatted: phoneNumber.formatInternational(),
      type: phoneNumber.getType(), // Returns 'MOBILE', 'FIXED_LINE', etc.
      e164: phoneNumber.format('E.164')
    };
  } catch (error) {
    return {
      valid: false,
      error: error.message
    };
  }
}

// Example usage
console.log(validateSanMarinoNumber('+378 0549 1234'));
console.log(validateSanMarinoNumber('6123 4567')); // Works with country context
console.log(validateSanMarinoNumber('+39 0549 1234')); // Handles legacy format

Python Example:

python
import phonenumbers
from phonenumbers import NumberParseException

def validate_san_marino_number(input_number):
    try:
        # Parse with SM region hint
        phone = phonenumbers.parse(input_number, "SM")

        return {
            'valid': phonenumbers.is_valid_number(phone),
            'formatted': phonenumbers.format_number(
                phone, phonenumbers.PhoneNumberFormat.INTERNATIONAL
            ),
            'type': phonenumbers.number_type(phone),
            'e164': phonenumbers.format_number(
                phone, phonenumbers.PhoneNumberFormat.E164
            )
        }
    except NumberParseException as e:
        return {
            'valid': False,
            'error': str(e)
        }

# Example usage
print(validate_san_marino_number('+378 0549 1234'))
print(validate_san_marino_number('6123 4567'))

Custom Regular Expression Validation

For lightweight validation without external dependencies, use these regular expressions:

javascript
// Handle various input formats (spaces, hyphens, parentheses)
function normalizeInput(input) {
  return input.replace(/[\s\-\(\)]/g, '');
}

// Geographic Numbers (with optional +39 legacy prefix)
const landlineRegex = /^\+378(0549)\d{4}$/;
const landlineLegacyRegex = /^\+39(0549)\d{6}$/;

// Mobile Numbers
const mobileRegex = /^\+3786\d{7}$/;

// IP Telephony
const voipRegex = /^\+3785\d{7}$/;

// Premium Rate Numbers
const premiumRegex = /^\+3787\d{7}$/;

function validateSanMarinoNumber(phoneNumber, type) {
  const normalized = normalizeInput(phoneNumber);

  const patterns = {
    landline: [landlineRegex, landlineLegacyRegex],
    mobile: [mobileRegex],
    voip: [voipRegex],
    premium: [premiumRegex]
  };

  // Convert +39 0549 to +378 0549 format for normalization
  let testNumber = normalized;
  if (normalized.startsWith('+390549')) {
    testNumber = '+378' + normalized.substring(3);
  }

  const typePatterns = patterns[type] || [];
  return typePatterns.some(pattern => pattern.test(testNumber));
}

// Example usage with various input formats:
console.log(validateSanMarinoNumber('+378 0549 1234', 'landline')); // true
console.log(validateSanMarinoNumber('+378-0549-1234', 'landline')); // true
console.log(validateSanMarinoNumber('+39 0549 123456', 'landline')); // true (legacy)
console.log(validateSanMarinoNumber('+378 6123 4567', 'mobile')); // true

Number Formatting

Consistent formatting enhances usability and interoperability. The E.164 format (+CountryCodeSubscriberNumber) is the international standard for storing phone numbers.

Best Practice: Store all phone numbers in E.164 format (no spaces, hyphens, or parentheses) in your database. Format for display only when presenting to users.

javascript
function formatToE164(localNumber, countryHint = 'SM') {
  // Remove all non-digit characters except leading +
  let cleaned = localNumber.replace(/[^\d+]/g, '');

  // Handle +39 0549 legacy format (convert to +378)
  if (cleaned.startsWith('+390549')) {
    cleaned = '+378' + cleaned.substring(3);
  }

  // Remove leading + for processing
  cleaned = cleaned.replace(/^\+/, '');

  // Add country code if not present
  if (!cleaned.startsWith('378')) {
    // Validate and add 378
    if (/^[05-7]\d+/.test(cleaned)) {
      cleaned = '378' + cleaned;
    } else {
      throw new Error('Invalid San Marino number format');
    }
  }

  return '+' + cleaned;
}

// Example usage:
console.log(formatToE164('0549 1234'));      // +37805491234
console.log(formatToE164('61234567'));       // +37861234567
console.log(formatToE164('+39 0549 123456')); // +37805491234566 (normalized from legacy)
console.log(formatToE164('+378-6123-4567')); // +37861234567

Database Schema Design

Use this production-ready SQL schema for efficient data management and GDPR compliance:

sql
CREATE TABLE phone_numbers (
    id SERIAL PRIMARY KEY,
    phone_number_e164 VARCHAR(15) NOT NULL UNIQUE,  -- Store in E.164 format
    country_code VARCHAR(3) NOT NULL DEFAULT '378',
    number_type ENUM('landline', 'mobile', 'voip', 'premium') NOT NULL,
    is_validated BOOLEAN DEFAULT false,

    -- GDPR compliance fields
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
    updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
    deleted_at TIMESTAMP NULL,  -- Soft delete for GDPR "right to be forgotten"

    -- Audit trail
    created_by VARCHAR(50),
    updated_by VARCHAR(50),
    consent_given BOOLEAN DEFAULT false,
    consent_date TIMESTAMP NULL,

    CONSTRAINT valid_san_marino_number
        CHECK (
            phone_number_e164 ~ '^\+378(0549|5|6|7)\d{4,7}$'
        )
);

-- Indexes for performance
CREATE INDEX idx_phone_number_e164 ON phone_numbers(phone_number_e164)
    WHERE deleted_at IS NULL;
CREATE INDEX idx_number_type ON phone_numbers(number_type)
    WHERE deleted_at IS NULL;
CREATE INDEX idx_deleted_at ON phone_numbers(deleted_at);

-- Trigger to update updated_at timestamp
CREATE OR REPLACE FUNCTION update_updated_at_column()
RETURNS TRIGGER AS $$
BEGIN
    NEW.updated_at = CURRENT_TIMESTAMP;
    RETURN NEW;
END;
$$ language 'plpgsql';

CREATE TRIGGER update_phone_numbers_updated_at
    BEFORE UPDATE ON phone_numbers
    FOR EACH ROW
    EXECUTE FUNCTION update_updated_at_column();

Key Design Decisions:

  • E.164 Storage: Store only in E.164 format (e.g., +37861234567) for consistency and easy international integration
  • Soft Deletes: Use deleted_at timestamp instead of hard deletes to maintain audit trail and support GDPR compliance
  • Consent Tracking: Track user consent for contact, required for GDPR and telecommunications regulations
  • Audit Trail: Track who created/modified records and when for compliance and debugging

Error Handling

Use this production-ready error handling approach:

python
import logging
from enum import Enum
from typing import Dict, Optional
import phonenumbers
from phonenumbers import NumberParseException

logger = logging.getLogger(__name__)

class PhoneNumberErrorType(Enum):
    """Enumeration of phone number error types"""
    INVALID_COUNTRY_CODE = "invalid_country_code"
    INVALID_FORMAT = "invalid_format"
    INVALID_LENGTH = "invalid_length"
    NOT_A_NUMBER = "not_a_number"
    UNKNOWN_ERROR = "unknown_error"

class PhoneNumberException(Exception):
    """Base exception for phone number handling"""
    def __init__(self, message: str, error_type: PhoneNumberErrorType,
                 user_message: str = None):
        self.message = message
        self.error_type = error_type
        self.user_message = user_message or "Invalid phone number format"
        super().__init__(self.message)

def process_san_marino_number(phone_number: str) -> Dict:
    """
    Process and validate a San Marino phone number.

    Args:
        phone_number: Input phone number string

    Returns:
        Dict containing validation results and formatted number

    Raises:
        PhoneNumberException: For invalid phone numbers
    """
    try:
        # Clean and parse
        cleaned_number = phone_number.strip()

        # Use libphonenumber for robust validation
        parsed = phonenumbers.parse(cleaned_number, "SM")

        if not phonenumbers.is_valid_number(parsed):
            raise PhoneNumberException(
                f"Invalid San Marino number: {cleaned_number}",
                PhoneNumberErrorType.INVALID_FORMAT,
                "Please enter a valid San Marino phone number"
            )

        return {
            'success': True,
            'e164': phonenumbers.format_number(
                parsed, phonenumbers.PhoneNumberFormat.E164
            ),
            'international': phonenumbers.format_number(
                parsed, phonenumbers.PhoneNumberFormat.INTERNATIONAL
            ),
            'national': phonenumbers.format_number(
                parsed, phonenumbers.PhoneNumberFormat.NATIONAL
            ),
            'type': str(phonenumbers.number_type(parsed)),
            'valid': True
        }

    except NumberParseException as e:
        # Map phonenumbers exceptions to our error types
        error_map = {
            NumberParseException.INVALID_COUNTRY_CODE: PhoneNumberErrorType.INVALID_COUNTRY_CODE,
            NumberParseException.NOT_A_NUMBER: PhoneNumberErrorType.NOT_A_NUMBER,
            NumberParseException.TOO_SHORT_NSN: PhoneNumberErrorType.INVALID_LENGTH,
            NumberParseException.TOO_LONG: PhoneNumberErrorType.INVALID_LENGTH,
        }

        error_type = error_map.get(e.error_type, PhoneNumberErrorType.INVALID_FORMAT)

        logger.warning(
            f"Phone number parsing failed: {str(e)}",
            extra={'input': phone_number, 'error_type': error_type.value}
        )

        return {
            'success': False,
            'valid': False,
            'error_type': error_type.value,
            'error_message': str(e),
            'user_message': 'Please enter a valid phone number in the format +378 XXXX XXXX'
        }

    except Exception as e:
        logger.exception(
            f"Unexpected error processing phone number: {str(e)}",
            extra={'input': phone_number}
        )

        return {
            'success': False,
            'valid': False,
            'error_type': PhoneNumberErrorType.UNKNOWN_ERROR.value,
            'error_message': str(e),
            'user_message': 'An error occurred while processing your phone number. Please try again.'
        }

# Example usage with user-facing and internal logging separation
result = process_san_marino_number("+378 0549 1234")
if result['success']:
    print(f"Valid number: {result['e164']}")
else:
    # Show user_message to end user
    print(f"User sees: {result['user_message']}")
    # Log detailed error internally
    logger.error(f"Internal error: {result['error_message']}")

Advanced Technical Considerations

This section covers advanced aspects of San Marino's telecommunications infrastructure.

Network Infrastructure

San Marino's network infrastructure is highly advanced:

  1. Fixed Network: The FTTH network provides 100% coverage with symmetric gigabit connections. Over 50% of users connect via fiber, with average fixed internet speeds of 96.8 Mbps (outperforming Italy's ~91.8 Mbps). The government plans to phase out copper (DSL) by 2027. [Source: Digital Watch Observatory] Leverage this infrastructure for high-bandwidth, low-latency applications.

  2. Mobile Network: San Marino achieved full 5G coverage (~99% of territory) by late 2018, becoming the first European country to do so. The network features:

    • 5G Coverage: ~99% (3.5 GHz and 26 GHz bands with Massive MIMO technology)
    • 4G/LTE Coverage: 99% of population
    • 3G Coverage: 99% of population
    • Major Operators: San Marino Telecom (SMT), Telefonia Mobile Sammarinese (TMS), Telecom Italia (TIM) San Marino
    • IoT Support: Network is IoT-ready with dedicated provisioning through operators

[Sources: ITU 5G Country Profile, Digital Watch]

For IoT implementations, contact operators directly for M2M/IoT number provisioning, which typically uses the standard mobile number ranges (6XXX) with specialized data plans.

Emergency Services Integration

Emergency numbers must always be accessible, even without a SIM card or from locked devices. San Marino uses the following emergency numbers:

  • 112: European emergency number (all emergency services)
  • 113: Police (Polizia Civile)
  • 115: Fire brigade (Vigili del Fuoco)
  • 118: Medical emergencies (Emergenza Sanitaria)

[Source: Wikipedia]

Compliance Requirements for VoIP/App-Based Services:

Applications providing voice or emergency calling functionality must:

  1. Emergency Number Access: Ensure 112, 113, 115, and 118 are always accessible without authentication or payment
  2. Location Information: Transmit caller location to emergency services when available
  3. Network Priority: Emergency calls must receive priority routing
  4. Testing: Conduct emergency call testing in coordination with ICT Authority using designated test numbers
  5. Documentation: Maintain documentation of emergency calling capabilities for regulatory review

Testing Procedures:

Test emergency service integration without disrupting actual services:

  • Contact the Telecommunication Sector (tlc@pa.sm, +378 0549 882552) to request test procedures
  • Use designated ITU test numbers:
    • Fixed line test: +378 (0549) 886377 (fixed tone)
    • Mobile test: +378 66 661212 (mobile tone)

[Source: ITU National Numbering Plan]

Never test emergency functionality using live emergency numbers.

Future Developments and Regulatory Oversight

Monitor future developments for long-term planning.

Number Portability

As of 2024, comprehensive information on mobile number portability (MNP) implementation in San Marino is limited. While MNP is growing across Europe, specific timelines or regulatory frameworks for San Marino have not been published.

For current status: Contact the ICT Authority or Telecommunication Sector for number portability availability and implementation plans.

Planned Developments

Potential future changes include:

  • Enhanced 5G Services: Expansion of 26 GHz millimeter-wave deployments
  • New Number Range Allocations: As the population and IoT devices grow
  • Digital Service Integration: Evolved requirements for government digital services
  • Blockchain Integration: San Marino is actively exploring distributed ledger technology applications in telecommunications [Source: ITU 5G Country Profile]

Regulatory Contacts

Telecommunication Sector Public Administration Office Borgo Maggiore, 192 Via 28 Luglio 47893 San Marino Email: tlc@pa.sm Phone: +378 0549 882552

ICT Authority Established by Delegated Decree no. 146/2018 (ratified by Delegated Decree no. 109 on 30 August 2018)

For current regulatory information and technical documentation:

Troubleshooting Common Implementation Issues

Issue 1: Numbers Not Validating

Symptoms: Valid San Marino numbers fail validation

Common Causes:

  • Not handling both +378 and +39 0549 prefixes
  • Regex doesn't account for optional spaces/hyphens in user input
  • Incorrect digit count expectations (6–10 digits, typically 8)

Solution:

javascript
// Normalize input before validation
function normalizePhoneNumber(input) {
  let cleaned = input.replace(/[\s\-\(\)]/g, '');

  // Convert legacy +39 0549 to +378 0549
  if (cleaned.startsWith('+390549')) {
    cleaned = cleaned.replace('+390549', '+3780549');
  }

  return cleaned;
}

Issue 2: Database Storage Inconsistencies

Symptoms: Duplicate numbers stored with different formatting

Solution:

  • Always normalize to E.164 format before storage
  • Use database constraints to enforce format
  • Apply normalization in application layer before insert/update

Issue 3: International Calling Issues

Symptoms: Outbound calls to San Marino fail

Common Causes:

  • Carrier doesn't recognize +378 country code (rare but possible)
  • Using wrong prefix (+39 vs +378)

Solution:

  • Always use +378 as primary format
  • For legacy systems having issues, try +39 0549 format
  • Contact your telecom carrier to ensure +378 routes are configured

Frequently Asked Questions About San Marino Phone Numbers

Q: What is the country code for San Marino? A: The San Marino country code is +378. When dialing from the US, dial 011-378 followed by the local number. From mobile phones internationally, dial +378 directly.

Q: Should I store phone numbers with +378 or +39 prefix? A: Always store using +378 (the official San Marino country code) in E.164 format. Accept both formats in user input but normalize to +378 for storage.

Q: Do I need to implement number portability checks? A: As of 2024, number portability implementation status in San Marino is not well-documented. Contact the ICT Authority for current requirements. Implement flexible type detection that doesn't hardcode prefix-to-operator mappings.

Q: Can I use the same validation logic for +39 Italy numbers? A: No. While San Marino landlines can be reached via +39 0549, Italian numbers have different formats and prefixes. Treat them as separate country codes in your application.

Q: How do I call a San Marino mobile number? A: San Marino mobile numbers start with 6 after the country code. Dial +378 6XXX XXXX (8 digits total after +378).

Q: What's the best library for phone number validation? A: Use Google's libphonenumber library. It handles San Marino numbers correctly, including both +378 and +39 0549 formats, and is regularly updated with carrier metadata.

Q: Are there special considerations for SMS delivery? A: Yes. San Marino has specific SMS regulations. For detailed SMS compliance guidance, see San Marino SMS Best Practices, which covers GDPR compliance, sender ID options, and carrier restrictions.

Q: How do I handle emergency numbers in my VoIP application? A: Emergency numbers (112, 113, 115, 118) must be accessible without authentication. Contact the Telecommunication Sector (tlc@pa.sm) for testing procedures. Never test with live emergency numbers.

Additional Code Examples

Java Implementation Using libphonenumber

java
import com.google.i18n.phonenumbers.NumberParseException;
import com.google.i18n.phonenumbers.PhoneNumberUtil;
import com.google.i18n.phonenumbers.Phonenumber.PhoneNumber;
import com.google.i18n.phonenumbers.PhoneNumberUtil.PhoneNumberType;

public class SanMarinoPhoneValidator {
    private static final PhoneNumberUtil phoneUtil = PhoneNumberUtil.getInstance();

    public static ValidationResult validateNumber(String input) {
        try {
            PhoneNumber number = phoneUtil.parse(input, "SM");
            boolean isValid = phoneUtil.isValidNumber(number);

            return new ValidationResult(
                isValid,
                phoneUtil.format(number, PhoneNumberUtil.PhoneNumberFormat.E164),
                phoneUtil.format(number, PhoneNumberUtil.PhoneNumberFormat.INTERNATIONAL),
                phoneUtil.getNumberType(number).toString()
            );
        } catch (NumberParseException e) {
            return new ValidationResult(false, null, null, null, e.getMessage());
        }
    }

    public static class ValidationResult {
        public final boolean valid;
        public final String e164;
        public final String international;
        public final String type;
        public final String error;

        public ValidationResult(boolean valid, String e164, String international,
                              String type, String error) {
            this.valid = valid;
            this.e164 = e164;
            this.international = international;
            this.type = type;
            this.error = error;
        }

        public ValidationResult(boolean valid, String e164, String international,
                              String type) {
            this(valid, e164, international, type, null);
        }
    }

    public static void main(String[] args) {
        ValidationResult result = validateNumber("+378 0549 1234");
        System.out.println("Valid: " + result.valid);
        System.out.println("E.164: " + result.e164);
        System.out.println("Type: " + result.type);
    }
}

PHP Implementation

php
<?php
require 'vendor/autoload.php';

use libphonenumber\PhoneNumberUtil;
use libphonenumber\PhoneNumberFormat;
use libphonenumber\NumberParseException;

class SanMarinoPhoneValidator {
    private $phoneUtil;

    public function __construct() {
        $this->phoneUtil = PhoneNumberUtil::getInstance();
    }

    public function validate($input) {
        try {
            $number = $this->phoneUtil->parse($input, 'SM');
            $isValid = $this->phoneUtil->isValidNumber($number);

            return [
                'valid' => $isValid,
                'e164' => $this->phoneUtil->format($number, PhoneNumberFormat::E164),
                'international' => $this->phoneUtil->format($number, PhoneNumberFormat::INTERNATIONAL),
                'type' => $this->phoneUtil->getNumberType($number),
                'country' => $this->phoneUtil->getRegionCodeForNumber($number)
            ];
        } catch (NumberParseException $e) {
            return [
                'valid' => false,
                'error' => $e->getMessage()
            ];
        }
    }
}

// Example usage
$validator = new SanMarinoPhoneValidator();
$result = $validator->validate('+378 0549 1234');
print_r($result);
?>

Conclusion

You now have the essential knowledge to handle San Marino phone numbers in your applications. With this understanding of numbering structure, validation rules, formatting best practices, and telecommunications context, you can confidently integrate San Marino's telecommunications system.

Key Takeaways:

  • Use +378 as the official country code, but accept +39 0549 for legacy compatibility
  • Store all numbers in E.164 format for consistency
  • Use libphonenumber library for robust validation in production
  • Implement GDPR-compliant database schemas with audit trails
  • Ensure emergency numbers (112, 113, 115, 118) are always accessible
  • Contact ICT Authority for current regulatory requirements

Stay informed about future developments and regulatory changes through official channels to ensure your applications remain compliant and future-proof.