Download the PHP package jmbg-labs/jmbg without Composer
On this page you can find all versions of the php package jmbg-labs/jmbg. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Table of contents
Download jmbg-labs/jmbg
More information about jmbg-labs/jmbg
Files in jmbg-labs/jmbg
Download jmbg-labs/jmbg
More information about jmbg-labs/jmbg
Files in jmbg-labs/jmbg
Vendor jmbg-labs
Package jmbg
Short Description Validate Serbian unique master citizen number (JMBG - Jedinstveni Matični Broj Građana)
License MIT
Homepage https://github.com/jmbg-labs/php
Package jmbg
Short Description Validate Serbian unique master citizen number (JMBG - Jedinstveni Matični Broj Građana)
License MIT
Homepage https://github.com/jmbg-labs/php
Please rate this library. Is it a good library?
Informations about the package jmbg
JMBG PHP Library
A PHP library for validating and parsing Serbian unique master citizen numbers (JMBG - Jedinstveni Matični Broj Građana).
Features
- ✅ Validate JMBG numbers with comprehensive checks
- ✅ Extract birth date, region, and gender information
- ✅ Support for all Serbian regions
- ✅ Calculate age from JMBG
- ✅ Type-safe with PHP 8.1+ features
- ✅ Fully tested with PHPUnit
- ✅ PSR-12 compliant code
Installation
Install via Composer:
Usage
Basic Validation
Extract Information
Using Magic Methods
JMBG Format
JMBG consists of 13 digits: DDMMYYYRRBBBC
- DD - Day of birth (01-31)
- MM - Month of birth (01-12)
- YYY - Year of birth (last 3 digits)
- RR - Region code
- BBB - Unique number (000-499 for males, 500-999 for females)
- C - Checksum digit
Supported Regions
The library supports all Serbian and ex-Yugoslav regions including (beware: ex-Yugoslav regions codes may have changed since the breakup):
- Serbia (71-79): Belgrade, Kragujevac, Niš, etc.
- Serbia/Vojvodina (80-89): Novi Sad, Subotica, Pančevo, etc.
- Serbia/Kosovo (91-96): Priština, Peć, Prizren, etc.
- Bosnia and Herzegovina (10-19)
- Montenegro (21-29)
- Croatia (30-39)
- Macedonia (41-49)
- Slovenia (50)
Validation Rules
The library performs comprehensive validation:
- Length check - Must be exactly 13 digits
- Format check - Must contain only numeric characters
- Date validation - Birth date must be valid (including leap year support)
- Region validation - Region code must exist in the registry
- Checksum validation - Modulo 11 algorithm verification
Development
Running Tests
Code Style
Requirements
- PHP ^8.1
- No external dependencies (for production use)
Contributing
Contributions are welcome! Please ensure:
- All tests pass (
composer test) - Code follows PSR-12 standards (
composer cs) - Add tests for new features
- Update documentation as needed
License
This project is licensed under the MIT License - see the LICENSE file for details.
Credits
Developed by JMBG Labs
Support
Examples
Validate Multiple JMBGs
Age Calculation
Error Handling
All versions of jmbg with dependencies
PHP Build Version
Package Version
Requires
php Version
^8.1
The package jmbg-labs/jmbg contains the following files
Loading the files please wait ...