Componette

Componette

h4kuna

h4kuna / fio-nette v3.0.0

Nette extension for Fio.

download-cloud-line composer require h4kuna/fio-nette

Fio for Nette

Downloads this Month Latest Stable Version Coverage Status Total Downloads License

Part of the h4kuna PHP libraries, see the overview of all packages.

Nette DI extension for h4kuna/fio, where you find the documentation of the library.

Install by composer

Requires PHP 8.2 or newer.

composer require h4kuna/fio-nette

# optional, default HTTP client and factories
composer require guzzlehttp/guzzle

If your container already has services implementing Psr\Http\Client\ClientInterface, Psr\Http\Message\RequestFactoryInterface and Psr\Http\Message\StreamFactoryInterface, the extension uses them, otherwise Guzzle is required.

Example NEON config

Define the extension:

extensions:
	fio: h4kuna\Fio\Nette\DI\FioExtension

Configure the extension:

fio:
	# mandatory
	account: 2600267402/2010
	token: 5asd64as5d46ad5a6

	# optional, the default is %tempDir%/h4kuna/fio
	tempDir: %tempDir%/fio

More accounts, the first one is the default:

fio:
	accounts:
		my-alias: # name to select the account
			account: 2600267402/2010
			token: 5asd64as5d46ad5a6
		next-alias:
			account: 123456789/3216
			token: 6a4sd54asadsasde564

The service fio.factory is autowired as h4kuna\Fio\Nette\FioFactory. Choose the account like this:

/** @var h4kuna\Fio\Nette\FioFactory $fioFactory */
$fioFactory = $container->getService('fio.factory');
$fioPay = $fioFactory->createFioPay('next-alias');

// both are the same, because the first one is the default
$fioRead = $fioFactory->createFioRead();
$fioRead = $fioFactory->createFioRead('my-alias');
  • v3.0.0

    • support last nette
    • support last h4kuna/fio
price-tag-2-line

Badges

guide-fill

Dependencies

php (>=8.0)
h4kuna/dir (^0.1.2)
nette/di (^3.1)
Componette Componette felix@nette.org