Download the PHP package ttbooking/fiscal-registrar without Composer
On this page you can find all versions of the php package ttbooking/fiscal-registrar. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download ttbooking/fiscal-registrar
More information about ttbooking/fiscal-registrar
Files in ttbooking/fiscal-registrar
Informations about the package fiscal-registrar
1. Overview
This Laravel package intended to make, store and process 54FZ-compatible receipts accepted by the Tax Service of Russian Federation through Fiscal Data Operators (FDO, ru ОФД). For the time being it supports most of the Fiscal Data Format (FDF, ru ФФД) 1.05 tags and ATOL Online service API v4 via supplemented driver.
2. Requirements
- PHP 8.1 or greater;
- Laravel Framework 10 or greater;
- Highly recommended: RDBMS with JSON column support;
- ATOL Online & FDO contracts and connection requisites (not needed for testing purposes).
3. Installation
Installation process is simple and straightforward as for almost any Laravel package.
You can install Fiscal Registrar package via Composer:
composer require ttbooking/fiscal-registrar
Package service provider and facade aliases will be automatically registered in your application if package discovery is configured for your project.
Next, you'll need to publish package configuration file (required) and database migration (optional, if you need to change table name or add columns, etc):
Then, if you've published migration, you'll need to make needed changes to it before proceeding to the next step.
In a default Laravel installation, look it up here: {
Finally, you should apply database migration, which will create table for receipt storage:
php artisan migrate
4. Configuration
4.1. Using customizable receipt model
First, if you made changes to the database migration (especially table name) during package installation, this step is mandatory.
Otherwise, it is completely optional.
Create Eloquent model in your application's Models namespace (or somewhere else), say (App\Models\Receipt
), and extend it from
the package supplemented default implementation (TTBooking\FiscalRegistrar\Models\Receipt
). Final result will look like this:
Note the $table
property - it should point to the actual receipt table.
Of course, you may customize this model as you wish, just don't break what already works :)
4.2. Configuring options
You will find Fiscal Registrar configuration file (published in the installation step) here: {
Main options are:
path
- path onto (under) which the routes (API & UI) will be mounted (grouped).middleware
- middleware to append to the package's routes.model
- register your custom receipt model here, and it will replace default model globally (package-wise).connection
- default connection instance with its own driver and configuration options. (Better use environment variable, see below)connections
- per-connection configurations, will be passed to the driver instances.connections.<name>.driver
- driver used for connection; if omitted, will try to resolve driver by connection's name.connections.<name>.callback
- callback URL, if supported by the provider and driver. By default, callback URL is autogenerated and doesn't need to be explicitly defined. In order to disable this behavior, you may define callback URL manually or disable callback at all, passing (assigning)false
(in)to the option.connections.<name>.*
- other driver-specific options.
Also, there is FR_CONNECTION
environment variable, which you may use in your project's .env file to choose default connection.
5. General Usage
The most straightforward way of usage in a client code is dependency injection using TTBooking\FiscalRegistrar\Contracts\FiscalRegistrar
interface.
This interface has two methods:
public function register(Operation $operation, string $externalId, Receipt $data): string
Register receipt described with Receipt
DTO ($data
argument) using $operation
registration method.
You must also provide unique identifier of the receipt in your system using $externalId
argument.
In the simplest case you may use Str::uuid()
helper function to generate this identifier.
The return value of this method will be the unique receipt identifier on the provider side.
The Receipt
DTO mostly resembles similar structure described in ATOL Online documentation.
public function report(string $id): ?Result
Check out current receipt status using identifier, returned by register
method.
6. Storage-agnostic FiscalRegistrar facade
7. Receipt facade w/ fluent interface
8. receipt() helper function
9. Web API counterparts
This package also may work as a microservice via its RESTful API.
10. Available console commands
11. Web UI (separate package, take a look)
12. Extending functionality / Writing drivers
All versions of fiscal-registrar with dependencies
endroid/qr-code Version ^6.0
laravel/framework Version ^10.0 || ^11.0
spatie/data-transfer-object Version ^3.5
spatie/laravel-query-builder Version ^5.0 || ^6.0
ttbooking/atol-client Version ^2.0