DI config from PHP using anonymous functions

Hi guys,

Please refer to: Class Phalcon\Di Toward the bottom there is "public loadFromPhp (mixed $filePath)"

I would like to use anonymouse functions for both shared and non-shared services, but I do not know the array key name, does anyone know how this can be done?

<?php
return [
    'myComponent' => [
        '?????' => function() { reutrn new CustomerServiceClass(); },
        'shared' => true,
    ],
    'group' => [
        '?????' => function( $type, $service ) {  return new CustomerServiceClass(); },
        'arguments' => [
            [
                'type' => 'service',
                'service' => 'myComponent',
            ],
        ],
    ]
];

Thanks, Dave

Hi @DaveGoodchild you try with

    return [
        'myComponent' => [
            function() { reutrn new CustomerServiceClass(); },
            'shared' => true,
     ],

I check loadFromPHP and probably works