PHPackages                             olssonm/swedish-entity - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Validation &amp; Sanitization](/categories/validation)
4. /
5. olssonm/swedish-entity

ActiveLibrary[Validation &amp; Sanitization](/categories/validation)

olssonm/swedish-entity
======================

Validator and formatter for Swedish personnummer and organisationsnummer. With Laravel validators.

v1.4.2(7mo ago)15196.1k—8.5%[1 PRs](https://github.com/olssonm/swedish-entity/pulls)MITPHPPHP ^8.2CI passing

Since Dec 8Pushed 5mo ago2 watchersCompare

[ Source](https://github.com/olssonm/swedish-entity)[ Packagist](https://packagist.org/packages/olssonm/swedish-entity)[ Docs](https://github.com/olssonm/swedish-entity)[ GitHub Sponsors](https://github.com/olssonm)[ RSS](/packages/olssonm-swedish-entity/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (3)Versions (21)Used By (0)

Swedish Entity
==============

[](#swedish-entity)

[![Latest Version on Packagist](https://camo.githubusercontent.com/36cbb7a280af3f78971d49350c23106660e5dcf62c8bda0b0a6e013ea0219bc8/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6f6c73736f6e6d2f737765646973682d656e746974792e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/olssonm/swedish-entity)[![PHP version](https://camo.githubusercontent.com/51d6d1357fcd73bdd8f60821cdf055c4fb6183b9651a1b37ba17b557307e7d94/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f6f6c73736f6e6d2f737765646973682d656e746974792e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/olssonm/swedish-entity)[![Build Status](https://camo.githubusercontent.com/3a6c35f1ed2c9a7cbb9aafb457ec3a39020357f3ffd213cb6490cb28aedf23df/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6f6c73736f6e6d2f737765646973682d656e746974792f72756e2d74657374732e796d6c3f7374796c653d666c61742d737175617265266c6162656c3d7465737473)](https://github.com/olssonm/swedish-entity/actions?query=workflow%3A%22Run+tests%22)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)

**Validate, format and extract data for Swedish personnummer (social security numbers) and organisationsnummer (organizational numbers).**

This package also handles the temporary personal identity number known as "Samordningsnummer" (a.k.a. coordination number).

Also includes [validators for Laravel](#laravel-validators).

–

The benefits of this package – while not always strictly according to the standard – is the ability to format using both short/long (10 or 12 characters) without or with a separator (i.e. 11/13 characters).

Note that companies always consists of 10/11 characters (with or without an optional separator).

This package use the excellent [personnummer/php](https://github.com/personnummer/php)-package as it's basis for the social security-handling, but with some additional attributes and methods.

Installation
------------

[](#installation)

```
composer require olssonm/swedish-entity

```

Usage
-----

[](#usage)

### Validation

[](#validation)

```
