|
1 | | -# euro-plate-validator |
2 | | -license-plate, validator, regex, europe, anpr, vehicle, car, nodejs, typescript, php, italy, germany, france, spain, uk, poland, netherlands, belgium, scandinavia, balkans, ukraine |
| 1 | +# 🌍 @codecorn/euro-plate-validator |
| 2 | + |
| 3 | +> 🚗 European license plate validator (Russia excluded). |
| 4 | +> Multi-country regex-based syntax validation for EU/EEA license plates. |
| 5 | +> Supports Node.js (TypeScript/JavaScript) and PHP implementations. |
| 6 | +
|
| 7 | +[](https://www.npmjs.com/package/@codecorn/euro-plate-validator) |
| 8 | + |
| 9 | +[](https://www.npmjs.com/package/@codecorn/euro-plate-validator) |
| 10 | +[](https://www.npmjs.com/package/@codecorn/euro-plate-validator) |
| 11 | +[](https://github.com/CodeCornTech/euro-plate-validator) |
| 12 | +[](https://github.com/CodeCornTech/euro-plate-validator/issues) |
| 13 | +[](https://github.com/CodeCornTech/euro-plate-validator/actions/workflows/test.yml) |
| 14 | +[](LICENSE) |
| 15 | + |
| 16 | +--- |
| 17 | + |
| 18 | +## ✨ Features |
| 19 | + |
| 20 | +- ✅ **Multi-country support** (25+ EU/EEA countries) |
| 21 | +- 🚫 **Russia excluded** by design |
| 22 | +- 🔠 Normalizes input (spaces, hyphens) |
| 23 | +- 🖥 Available for **Node.js/TypeScript** and **PHP** |
| 24 | +- 📦 Ready to publish on **npm** |
| 25 | + |
| 26 | +--- |
| 27 | + |
| 28 | +## 📦 Installation |
| 29 | + |
| 30 | +### Node.js / TypeScript |
| 31 | + |
| 32 | +```bash |
| 33 | +npm install @codecorn/euro-plate-validator |
| 34 | +``` |
| 35 | + |
| 36 | +### PHP |
| 37 | + |
| 38 | +Scarica `EuroPlateValidator.php` nella tua codebase. |
| 39 | + |
| 40 | +--- |
| 41 | + |
| 42 | +## 🚀 Usage |
| 43 | + |
| 44 | +### Node.js / TypeScript |
| 45 | + |
| 46 | +```ts |
| 47 | +import { validatePlate } from "@codecorn/euro-plate-validator"; |
| 48 | + |
| 49 | +// Italy |
| 50 | +console.log(validatePlate("AB 123 CD", ["IT"])); |
| 51 | +// -> { isValid: true, matches: [{country:"IT", name:"Italy"}], checked:["IT"] } |
| 52 | + |
| 53 | +// UK |
| 54 | +console.log(validatePlate("AB12 CDE", ["UK", "IE"])); |
| 55 | +``` |
| 56 | + |
| 57 | +**Esempi veloci:** |
| 58 | + |
| 59 | +```ts |
| 60 | +import { validatePlate } from "./dist/index.js"; |
| 61 | + |
| 62 | +validatePlate("AB 123 CD", ["IT"], { vehicleType: "car" }); // ✅ IT Car |
| 63 | +validatePlate("AA 12345", ["IT"], { vehicleType: "motorcycle" }); // ✅ IT Moto |
| 64 | +validatePlate("AA 12345", ["IT"], { vehicleType: "car" }); // ❌ (no_match) |
| 65 | +``` |
| 66 | + |
| 67 | +### PHP |
| 68 | + |
| 69 | +```php |
| 70 | +require '_php_variant/EuroPlateValidator.php'; |
| 71 | + |
| 72 | +print_r(validate_plate("AB 123 CD", ["IT"], "car")); |
| 73 | +print_r(validate_plate("AA 12345", ["IT"], "motorcycle")); |
| 74 | +``` |
| 75 | + |
| 76 | +### 🔧 CLI |
| 77 | + |
| 78 | +```bash |
| 79 | +npx @codecorn/euro-plate-validator "AB 123 CD" --countries IT,FR,DE --type car --pretty |
| 80 | +``` |
| 81 | + |
| 82 | +Opzioni: |
| 83 | + |
| 84 | +- `--countries` / `-c`: lista di country code (comma-sep) |
| 85 | +- `--type` / `-t`: `car` | `motorcycle` | `any` (default: `any`) |
| 86 | +- `--pretty` / `-p`: output leggibile |
| 87 | + |
| 88 | +Exit code: `0` se valido, `1` se non valido, `2` argomenti errati. |
| 89 | + |
| 90 | +**Esempi CLI:** |
| 91 | + |
| 92 | +```bash |
| 93 | +# Car IT |
| 94 | +npx euro-plate-validator "AB 123 CD" --countries IT --type car --pretty |
| 95 | + |
| 96 | +# Moto IT |
| 97 | +npx euro-plate-validator "AA 12345" --countries IT --type motorcycle --pretty |
| 98 | + |
| 99 | +# UK / IE |
| 100 | +npx euro-plate-validator "AB12 CDE" --countries UK,IE --type any |
| 101 | +``` |
| 102 | + |
| 103 | +--- |
| 104 | + |
| 105 | +## 🌍 Supported Countries |
| 106 | + |
| 107 | +🇮🇹 IT | 🇬🇧 UK | 🇩🇪 DE | 🇫🇷 FR | 🇪🇸 ES | 🇵🇹 PT | 🇳🇱 NL | 🇧🇪 BE | 🇨🇭 CH | 🇦🇹 AT | 🇮🇪 IE | 🇱🇺 LU |
| 108 | +🇩🇰 DK | 🇸🇪 SE | 🇳🇴 NO | 🇫🇮 FI | 🇵🇱 PL | 🇨🇿 CZ | 🇸🇰 SK | 🇭🇺 HU | 🇷🇴 RO | 🇧🇬 BG | 🇸🇮 SI | 🇭🇷 HR | 🇬🇷 GR |
| 109 | +🇱🇹 LT | 🇱🇻 LV | 🇪🇪 EE | 🇺🇦 UA |
| 110 | + |
| 111 | +--- |
| 112 | + |
| 113 | +## 📝 License |
| 114 | + |
| 115 | +MIT © [CodeCorn™](https://codecorn.it) |
| 116 | + |
| 117 | +Distribuito sotto licenza [MIT](LICENSE). |
| 118 | + |
| 119 | +--- |
| 120 | + |
| 121 | +## 👤 Maintainer |
| 122 | + |
| 123 | +<div style="display: flex; justify-content: space-between; align-items: center;"> |
| 124 | + <div> |
| 125 | + <p><strong>👨💻 Federico Girolami</strong></p> |
| 126 | + <p><strong>Full Stack Developer</strong> | <strong>System Integrator</strong> | <strong>Digital Solution Architect</strong> 🚀</p> |
| 127 | + <p>📫 <strong>Get in Touch</strong></p> |
| 128 | + <p>🌐 <strong>Website</strong>: <a href="https://codecorn.it">codecorn.it</a> *(Under Construction)*</p> |
| 129 | + <p>📧 <strong>Email</strong>: <a href="mailto:f.girolami@codecorn.it">f.girolami@codecorn.it</a></p> |
| 130 | + <p>🐙 <strong>GitHub</strong>: <a href="https://github.com/fgirolami29">github.com/fgirolami29</a></p> |
| 131 | + </div> |
| 132 | + <div style="text-align: center;"> |
| 133 | + <a href="https://www.codecorn.it"> |
| 134 | + <img src="https://codecorn.it/wp-content/uploads/2025/05/CODECORN-trasp-qhite.png" alt="Code Corn Logo" width="250px" height="90px" style="margin-top:30px;margin-bottom:20px;"/> |
| 135 | + </a> |
| 136 | + <a href="https://github.com/fgirolami29"> |
| 137 | + <img src="https://avatars.githubusercontent.com/u/68548715?s=200&v=4" alt="Federico Girolami Avatar" style="border-radius: 50%; width: 125px; height: 125px;border: 5px solid gold" /> |
| 138 | + </a> |
| 139 | + </div> |
| 140 | +</div> |
| 141 | + |
| 142 | +--- |
| 143 | + |
| 144 | +### 🤝 Contribute |
| 145 | + |
| 146 | +Pull request benvenute. Per grosse modifiche apri una issue prima di iniziare. |
| 147 | + |
| 148 | +> Powered by CodeCorn™ 🚀 |
0 commit comments