Download the PHP package werk365/identitydocuments without Composer

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


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.

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?

All versions of identitydocuments with dependencies

Informations about the package identitydocuments

Laravel Identity Documents

Latest Version on Packagist Total Downloads StyleCI

For general questions and suggestions join gitter:

Join the chat at

Package that allows you to handle documents like passports and other documents that contain a Machine Readable Zone (MRZ).

This package allows you to process images of documents to find the MRZ, parse the MRZ, parse the Visual Inspection Zone (VIZ) and also to find and return a crop of the passport picture (using face detection).

⚠️ Version 2.x is a complete rewrite of the package with a new MRZ detection algorithm and is not compatible with version 1.x


Via Composer

Publish config (optional)



The first important thing to know about the package is that you can use any OCR and or Face Detection API that you want. This package is not doing any of those itself.

Google Vision Service

Included with the package is a Google service class that will be loaded for both OCR and Face Detection by default. If you wish to use the Google service, no further configuration is required besides providing your credentials. To do this, make a service account and download the JSON key file. Then convert the JSON to a PHP array so it can be used as a normal Laravel config file. Your config file would have to be called google_key.php, be placed in the config folder and look like this:

Creating Custom Services

If you want to use any other API for OCR and/or Face Detection, you can make your own service, or take a look at our list of available services not included in the main package (WIP).

Making a service is relatively easy, if you want to make a service that does the OCR, all you have to do is create a class that implements Werk365\IdentityDocuments\Interfaces\OCR. Similarly, there is also a Werk365\IdentityDocuments\Interfaces\FaceDetection interface. To make creating custom services even easier you can use the following command:

Where name is the ClassName of the service you wish to create, and type is either OCR, FaceDetection or Both. This will create a new (empty) service for you in your App\Services namespace implementing the OCR, FaceDetection or both interfaces.


Basic usage

Create a new Identity Document with a maximum of 2 images (optional) in this example we'll use a POST request that includes 2 images on our example controller.

⚠️ In this example I use uploaded files, but you can use any files supported by Intervention

There are now a few things we can do with this newly created Identity Document. First of all finding and returning the MRZ:

We can then also get a parsed version of the MRZ by using

As the MRZ only allows for A-Z and 0-9 characters, anyone with accents in their name would not get a correct first or last name from the MRZ. To (attempt to) find the correct first and last name on the VIZ part of the document, use:

This will return an array containing both the found first and last names as well as a confidence score. The confidence score is a number between 0 and 1 and shows the similarity between the MRZ and VIZ version of the name. Please not that results can differ based on your system's iconv() implementation.

To get the passport picture from the document use:

This returns an Intervention\Image\Image

Get all of the above

If you wish to use all of these in a simplified way, you can also use the static all() method, which also expects up to two images as argument. For example:

The all() method returns an array that looks like this:

As you can see this includes all the above mentioned methods, plus the $document->type variable. The detected face will be returned as a base64 image string, with an image height of 200px.

Merging images

There are a couple of methods that will configure how the Identity Document is handled. First of all there's the mergeBackAndFrontImages() method. This method can be used to reduce the amount of OCR API calls have to be made. Images will be stacked on top of each other when this method is used. Please note that this method would have to be used before the getMrz() method. Example:

⚠️ Please note that merging images might cause high memory usage, depending on the size of your images

If you wish to use the static all() method and merge the images, publish the package's config file and enable it in there. Note that changing the option in the config will only apply to the all() method. Default config value:

Setting an OCR service

If you have made a custom OCR service or are using one different than the default Google service, you can use the setOcrService() method. For example let's say we've creating a new TesseractService using the methods described above, we can use it for OCR like this:

If you wish to use the all() method, publish the package's config and set the correct service class there.

Setting a Face Detection Service

This can be done in a similar way as the OCR service, using the setFaceDetectionService() method. For example:

If you wish to use the all() method, publish the package's config and set the correct service class there.

Other methods

addBackImage() sets the back image of the IdentityDocument. addFrontImage() sets the front image of the IdentityDocument. setMrz() sets the IdentityDcoument MRZ, for if you just wish to use the parsing functionality.

More information

If you're interested in how some things work internally, or if you would like to see an example of how to build a custom service within the package, I've written a blog post about all of that which you can find here:

Change log

Please see the changelog for more information on what has changed recently.


Please see for details and a todolist.


If you discover any security related issues, please email [email protected] instead of using the issue tracker.



. Please see the license file for more information.

Requires google/cloud-vision Version ^1.3
intervention/image Version ^2.5
illuminate/support Version ~5|~6|~7|~8|~9

The package werk365/identitydocuments contains the following files

Loading the files please wait ....