PHPackages                             osumionline/plugin-ticketbai - 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. [Framework](/categories/framework)
4. /
5. osumionline/plugin-ticketbai

ActiveLibrary[Framework](/categories/framework)

osumionline/plugin-ticketbai
============================

Plugin OTicketBai para Osumi Framework

2.0.0(1y ago)022MITPHPPHP &gt;=8.2

Since Sep 3Pushed 1y ago1 watchersCompare

[ Source](https://github.com/osumionline/plugin-ticketbai)[ Packagist](https://packagist.org/packages/osumionline/plugin-ticketbai)[ RSS](/packages/osumionline-plugin-ticketbai/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)DependenciesVersions (2)Used By (0)

Osumi Framework Plugins: `OTicketBai`

Este plugin añade la clase `OTicketBai` al framework con la que se pueden hacer llamadas al servicio [TicketBaiWS](https://ticketbaiws.eus) de [Berein](https://www.berein.com/). La consiguración se realiza en el archivo `Config.json` general de la aplicación. Es necesario estar registrado en TicketBaiWS y obtener el `token` y el `nif` de su panel de configuración.

Configuración

```
{
  ...,
  "plugins": {
    "ticketbai": {
        "token": "asdf123...",
        "nif": "12345678Z"
    }
  },
}
```

Uso del plugin

```
$tbai = new OTicketBai(true); // true sirve para indicar producción y false para indicar el entorno test

// Primero se comprueba el estado del servicio y si está activo se pueden realizar las peticiones
if ($tbai->checkStatus()) {
  /**
	 * Este método permite enviar una factura a la hacienda foral correspondiente y devolverá la huella TBAI, la imagen código QR en base64
	 * y la URL de validación de la factura de la hacienda foral que contiene el QR. El entorno de test permite generar TBAIs en el entorno
	 * de pruebas de la hacienda correspondiente.
   */

  $datosTBai = [
    'fecha'                     => date('d/m/Y', time()),
    'hora'                      => date('H:i:s', time()),
    'nif'                       => '',
    'nombre'                    => '',
    'direccion'                 => '',
    'cp'                        => '',
    'serie'                     => 'TPV01',
    'numero'                    => sprintf('%06d', $num_venta),
    'simplificada'              => true,
    'modo_recargo_equivalencia' => true,
    'rectificativa'             => false,
    'importacion'               => false,
    'intracomunitaria'          => false,
    'retencion'                 => 0,
    'lineas'                    => [],
    'total_factura'             => $total_factura
  ];

  // Por cada línea de la venta se crea un objeto datos_linea
  foreach ($lineas as $linea) {
    $importe_siva = $linea->get('pvp') / (1 + ($linea->get('iva') / 100));

    $datos_linea = [
      'iva'              => ($linea->get('iva') == 0) ? 21 : $linea->get('iva'),
      'descripcion'      => html_entity_decode($linea->get('nombre_articulo')),
      'cantidad'         => $linea->get('unidades'),
      'importe_unitario' => round($importe_siva, 4),
      'tipo_iva'         => $linea->get('iva'),
      'tipo_req'         => 0
    ];

    array_push($datosTBai['lineas'], $datos_linea);
  }

  // Se envía el objeto con todos los datos de la factura y las líneas de ventas
  $response = $tbai->nuevoTbai($datosTBai);
  if (is_array($response)) {
    echo "TicketBai response OK";
    // $response['huella_tbai'] Datos de la huella TicketBai
    // $response['qr'] Imagen del código QR en formato Base64
    // $response['url']  URL de validación de la factura de la hacienda foral
  }
  else {
    echo "TicketBai response ERROR";
  }
}
```

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance36

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 66.7% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

613d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/c03a0c641fe19db3016e1e289f1fb2531660199206a23dac404f00ea8c428619?d=identicon)[osumionline](/maintainers/osumionline)

---

Top Contributors

[![igorosabel](https://avatars.githubusercontent.com/u/633864?v=4)](https://github.com/igorosabel "igorosabel (2 commits)")[![osumionline](https://avatars.githubusercontent.com/u/156799685?v=4)](https://github.com/osumionline "osumionline (1 commits)")

### Embed Badge

![Health badge](/badges/osumionline-plugin-ticketbai/health.svg)

```
[![Health](https://phpackages.com/badges/osumionline-plugin-ticketbai/health.svg)](https://phpackages.com/packages/osumionline-plugin-ticketbai)
```

###  Alternatives

[laravel/telescope

An elegant debug assistant for the Laravel framework.

5.2k67.8M190](/packages/laravel-telescope)[laravel/passport

Laravel Passport provides OAuth2 server support to Laravel.

3.4k85.0M529](/packages/laravel-passport)[spiral/roadrunner

RoadRunner: High-performance PHP application server and process manager written in Go and powered with plugins

8.4k12.2M84](/packages/spiral-roadrunner)[nolimits4web/swiper

Most modern mobile touch slider and framework with hardware accelerated transitions

41.8k177.2k1](/packages/nolimits4web-swiper)[laravel/dusk

Laravel Dusk provides simple end-to-end testing and browser automation.

1.9k36.7M255](/packages/laravel-dusk)[laravel/prompts

Add beautiful and user-friendly forms to your command-line applications.

708181.8M591](/packages/laravel-prompts)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
