Download the PHP package dannyps/ccidadao without Composer

On this page you can find all versions of the php package dannyps/ccidadao. 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 ccidadao

CCidadao

CCidadao is a PHP Class used to validate and generate Citizen Card numbers.

How to use

Instalation

CCidadao is available on Packagist! You can install it via Composer, by typing:

$ composer require Dannyps/CCidadao

The class will be auto-loaded by composer. Thus, in order to use it, you need only require 'vendor/autoload.php'; in your PHP script.

Softening the curve

Portuguese Citizen Cards are a complicated subject. They have two check digits, and a weird version control system. Internal variables contain the following fields:

In the example number:

Moreover, the $ccd depends solely on the $num, whereas the $vcd depends on the $num and on the $vcc.

Code Examples

Test code is a good place to start. However, code examples are displayed below for your convenience.

Generating an array of valid CC numbers.

Note: The fact these numbers are valid does not mean they are being used by anyone.

Getting the next version of a CC number

As time goes by, people get new Citizen Cards. However, their numbers are already predestined. Because of the algorithm used, it is possible to foresee all possible numbers. Moreover, we know these numbers are sequential.

Validating a CC number

Motivation

There was an interest in being able to quickly generate valid CC numbers for pentesting reasons. Thus, CCidadao was born. Its applications, however, are more abrangent than that.

Contributing

You are welcome to contribute to the code, as well as to the documentation. You should do so by means of a Pull Request. You may use xDebug to profile the execution and find the less effecient methods.

How does it work?

The algorithms to determine both control digits are available online, in some blogs and similar pages. Testing of this class began with real CC numbers, as this was the only way to make sure the code was developed according to reality.


All versions of ccidadao with dependencies

PHP Build Version
Package Version
Requires php Version ^7.0.0
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 dannyps/ccidadao contains the following files

Loading the files please wait ....