maxa-ondrej / nette-di

Nette Framework better

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Nette Framework DI Extension

Usage

composer require maxa-ondrej/nette-di

Nette Framework Usage

config.neon

extensions:
    better-di: Maxa\Ondrej\Nette\DI\DIExtension
<?php declare(strict_types=1);

use Maxa\Ondrej\Nette\DI\Parameter;
use Maxa\Ondrej\Nette\DI\Service;

#[Service]
class MyService {

    #[Parameter('app.url')]
    public string $url;
    
}

#[Service(
    name: 'my.epic.service',
    tags: 'cache',
    setup: '$object->setDebugMode($container->getParameters()["debugMode"]);',
    autostart: true,
    autowired: true
)]
class NamedService {

    private bool $debugMode = true;

    public function setDebugMode(bool $debugMode): void {
        $this->debugMode = $debugMode;
    }
    
}

About

Nette Framework better

License:MIT License


Languages

Language:PHP 96.6%Language:Makefile 3.4%