PHP Classes

File: src/App/Ajax/Traits/DiTrait.php

Recommend this page to a friend!
  Packages of Thierry Feuzeu   Jaxon   src/App/Ajax/Traits/DiTrait.php   Download  
File: src/App/Ajax/Traits/DiTrait.php
Role: Class source
Content type: text/plain
Description: Class source
Class: Jaxon
Call PHP classes from JavaScript using AJAX
Author: By
Last change:
Date: 4 months ago
Size: 1,099 bytes
 

Contents

Class file image Download
<?php

/**
 * DiTrait.php
 *
 * DI containers.
 *
 * @package jaxon-core
 * @copyright 2025 Thierry Feuzeu <thierry.feuzeu@gmail.com>
 * @license https://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License
 * @link https://github.com/jaxon-php/jaxon-core
 */

namespace Jaxon\App\Ajax\Traits;

use
Jaxon\App\Config\ConfigManager;
use
Jaxon\Di\ComponentContainer;
use
Jaxon\Di\Container;

trait
DiTrait
{
   
/**
     * @var Container
     */
   
private Container $xContainer;

   
/**
     * @var ComponentContainer
     */
   
protected ComponentContainer $xComponentContainer;

   
/**
     * Get the DI container
     *
     * @return Container
     */
   
public function di(): Container
   
{
        return
$this->xContainer;
    }

   
/**
     * Get the component DI container
     *
     * @return ComponentContainer
     */
   
public function cdi(): ComponentContainer
   
{
        return
$this->xComponentContainer;
    }

   
/**
     * @return ConfigManager
     */
   
public function config(): ConfigManager
   
{
        return
$this->di()->g(ConfigManager::class);
    }
}