Download the PHP package reducktion/socrates without Composer

On this page you can find all versions of the php package reducktion/socrates. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package socrates

Badge Total Downloads Latest Version License StyleCI Contributors


Introduction

I am a Citizen of the World, and my Nationality is Goodwill.

Socrates is a PHP Package that allows you to validate and retrieve personal data from National Identification Numbers. Most countries in Europe are supported as well as some North and South American ones, with the goal to support as many countries in the world as possible.

Some countries also encode personal information of the citizen, such as gender or the place of birth. This package allows you to extract that information in a consistent way.

This package can be useful for many things such as validating a user's ID for finance related applications or verifying a user's age without asking for it explicitly. We recommend you review your country's data processing and protection laws before storing any information.

Ports of this package to other languages are currently in progress. Check further below for which ones are currently available.

PHP Version

PHP 8.1 is the minimum required version. If you are using an older version you should pull in the 1.3.0 version of this package. We highly recommend you upgrade though!

Installation

composer require reducktion/socrates

Usage

Socrates provides two methods: validateId and getCitizenDataFromId. Both receive an ID and the country code as a backed enum with the ISO 3166-2 format as the first and second parameters respectively. Simply instantiate the class and call the method you wish:

validateId

This method will return true or false. In case the ID has a wrong character length an InvalidLengthException will be thrown.

getCitizenDataFromId

This method will return an instance of Citizen.
If the ID is invalid, an InvalidIdException will be thrown.
If the country does not support data extraction, an UnsupportedOperationException will be thrown.

The Citizen class stores the extracted citizen data in a consistent format across all countries.
It exposes the getGender(), getDateOfBirth(), getAge() and getPlaceOfBirth() methods.

getGender will return an instance of the Gender enum.
getPlaceOfBirth will return a city or region name as a string.
getAge() returns the age of the citizen as an int.
getDateOfBirth() returns a DateTime instance.

Using the example above, Estonia only encodes the date of birth and gender of the citizen in their ID. So the above methods will return:

Supported and Unsupported Countries

Here you can see the full list of supported countries and whether they support data extraction.

Four european countries are currently unsupported: Austria πŸ‡¦πŸ‡Ή, Belarus πŸ‡§πŸ‡Ύ, Cyprus πŸ‡¨πŸ‡Ύ and Luxembourg πŸ‡±πŸ‡Ί. A number of countries in the Americas are also unsupported. This is because we could not find a reliable source for the algorithm, if at all. Help would be appreciated to get these countries supported.

Testing

composer test

Ports

This package is also available for the following languages:

Rust
Java

Contributing

Did you find a problem in any of the algorithms? Do you know how to implement a country which we have missed? Are there any improvements that you think should be made to the codebase? Any help is appreciated! Take a look at our contributing guidelines.

Code of Conduct

Our CoC is based on Ruby's. Check out our code of conduct.

License

The MIT License (MIT). Please see License File for more information.

Credits

Socrates was made with πŸ’– by Alexandre Olival and JoΓ£o Cruz. We are Reducktion. We hope to make someone's life easier after all the hard work compiling, researching, reverse-engineering and agonizing over ID validation algorithms - many of which were very obscure and hard to find.

Special Thanks

A big thanks goes to these people who helped us either test with real life IDs or guide us in finding the algorithm for their countries:

and Nair from πŸ‡΅πŸ‡Ή for the package name.

Contributors ✨

Thanks goes to these wonderful people (emoji key):


SLourenco

πŸ› πŸ“– πŸ’»

FlΓ‘vio Heleno

πŸ’» πŸ“–

Yves Bos

πŸ“– πŸ’» πŸ›

bofalke

πŸ’» πŸ“–

Rodolpho Lima

πŸ’» πŸ“–

tiagomichaelsousa

πŸ’» πŸ“–

This project follows the all-contributors specification. Contributions of any kind welcome!


All versions of socrates with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package reducktion/socrates contains the following files

Loading the files please wait ....