PHP code example of ruudvdd / ogm

1. Go to this page and download the library: Download ruudvdd/ogm 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/ */

    

ruudvdd / ogm example snippets


$generator = new \Ruudvdd\OGM\Generator();

// Plain number (default)
$generator->generate(false);

// Formatted
$generator->generate(true);

// Choose the first x digits (max 10)
$generator->generate(false, 1234);


$validator = new \Ruudvdd\OGM\Validator();

// Validate a formatted OGM
$validator->isValid('+++090/9337/55493+++'); // true

// Validate a plain number (12 digits)
$validator->digitsAreValid('090933755493');