PHP code example of consulta / laravel

1. Go to this page and download the library: Download consulta/laravel library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

consulta / laravel example snippets


use Consulta\Laravel\Consulta;

$person = Consulta::reniec()->find('43989177');

// respuesta:
array:6 [▼
  "dni" => "43989177"
  "nombres" => "CARLOS EMMANUEL"
  "apellido_paterno" => "CERVERA"
  "apellido_materno" => "BARTUREN"
  "caracter_verificacion" => "2"
  "caracter_verificacion_anterior" => null
]


use Consulta\Laravel\Consulta;

$companybyDni = Consulta::sunat()->byDni('46126030');

//respuesta
array:12 [▼
  "ruc" => 10461260301
  "razon_social" => "VIDAL LUJAN PAUL EDWIN"
  "tipo_contribuyente" => "PERSONA NATURAL SIN NEGOCIO"
  "nombre_comercial" => "SERVICIOS MÚLTIPLES DMC"
  "fecha_inscripcion" => "16-09-2009"
  "fecha_inicio_actividades" => "01-10-2009"
  "estado_contribuyente" => "ACTIVO"
  "condicion_contribuyente" => "HABIDO"
  "direccion" => "-"
  "sistema_emision_comprobante" => "MANUAL"
  "actividad_comercio_exterior" => "SIN ACTIVIDAD"
  "sistema_contabilidad" => "MANUAL"
]

use Consulta\Laravel\Consulta;

$company = Consulta::sunat()->byRuc('20601772541');

//consulta
array:12 [▼
  "ruc" => 20601772541
  "razon_social" => "TECACTUS S.A.C."
  "tipo_contribuyente" => "SOCIEDAD ANONIMA CERRADA"
  "nombre_comercial" => "-"
  "fecha_inscripcion" => "03-01-2017"
  "fecha_inicio_actividades" => "03-01-2017"
  "estado_contribuyente" => "ACTIVO"
  "condicion_contribuyente" => "HABIDO"
  "direccion" => "CAL.TRES NRO. 231 DPTO. 613 URB. JACARANDA LIMA - LIMA - SAN BORJA"
  "sistema_emision_comprobante" => "MANUAL/COMPUTARIZADO"
  "actividad_comercio_exterior" => "IMPORTADOR/EXPORTADOR"
  "sistema_contabilidad" => "MANUAL/COMPUTARIZADO"
]

use Consulta\Laravel\Consulta;

$companybyDni = Consulta::vehicle()->find('<placa>'); // placa sin guión

//respuesta de ejemplo.Se han ocultado datos en esta respuesta por seguridad
array:12 [▼
  "data" => array:8 [
    "plate" => "<placa>"
    "current_plate" => "<placa>"
    "registration_entry" => "<número de partida>"
    "vehicle_information" => array:31 [
      "vin" => "<bin info>"
      "axles" => "2"
      "brand" => "JEEP"
      "color" => "GRIS"
      "model" => "GRAND CHEROKEE LIMITED"
      "plate" => "<placa>"
      "seats" => "5"
      "usage" => "Vehiculos Particulares (Categoria M)"
      "width" => "2.15"
      "height" => "1.78"
      "length" => "4.82"
      "status" => "EN CIRCULACION"
      "wheels" => "4"
      "payload" => "0.787"
      "version" => "4X4"
      "category" => "M1"
      "body_type" => "SUV"
      "condition" => "SIN DEFINIR"
      "cylinders" => "6"
      "fuel_type" => "GASOLINA"
      "drivetrain" => "4X4"
      "dry_weight" => "2.162"
      "model_year" => "2012"
      "passengers" => "4"
      "engine_power" => "210@6350"
      "gross_weight" => "2.949"
      "current_plate" => "<placa>"
      "engine_number" => "<engine_number>"
      "serial_number" => "<serial_number>"
      "manufacturing_year" => "2012"
      "engine_displacement" => "3.6"
    ]
    "previous_plates" => []
    "owners" => array:1 [
      0 => array:5 [
        "name" => "<nombre del propietario actual>"
        "type" => "person"
        "title_number" => "<número de título>"
        "ownership_date" => "<fecha>"
        "document_number" => "<dni>"
      ]
    ]
    "previous_owners" => array:3 [
      0 => array:1 [
        0 => array:3 [
          "name" => "<nombre propietario anterior>"
          "document_type" => "PARTIDA"
          "document_number" => "<document_number>"
        ]
      ]
      1 => array:1 [
        0 => array:3 [
          "name" => "<nombre propietario anterior>"
          "document_type" => "PARTIDA"
          "document_number" => "<document_number>"
        ]
      ]
      2 => array:1 [
        0 => array:3 [
          "name" => "<nombre propietario anterior>"
          "document_type" => "PARTIDA"
          "document_number" => "<document_number>"
        ]
      ]
    ]
    "liens" => []
  ]
]

// in a `FormRequest` 

public function rules()
{
    return [
        'dni' => "i)],
    ];
}

// in a `FormRequest` 

public function rules()
{
    return [
        'dni' => ['

// in a `FormRequest` 

public function rules()
{
    return [
        'ruc' => ['