No announcement yet.

Namespace/use statement and composer fetched/generated code in scriptcase

  • Filter
  • Time
  • Show
Clear All
new posts

  • Namespace/use statement and composer fetched/generated code in scriptcase

    Dear All,
    I am having problems in using by composer fetched/generated code in scriptcase.
    I would like to use library's created by others. More and more the use of composer and using namespaces is common.
    May be it is not possible at all but here is an example problem !
    Code to implement: require_once
    __DIR__ . '/../vendor/autoload.php'; use Monolog\Logger; $logger = new Logger('Logger');
    This code works in standard php with sources placed in the right directory.
    I have placed this code in a blank application in scriptcase which did not work directly. As I understand from the generated code as the 'use' statement is not in the main part of the source but in a function namespaces cannot not work.
    Than I placed the code in a library monologtest.php in directory C:\Program Files\NetMake\v9\wwwroot\scriptcase\app\security22 \_lib\libraries\scriptcase\monologtest.php.
    In the main blank execute part I coded this:
    Code implemented: monologtest.php:
    Monolog\Logger; $logger = new Logger('Logger');
    blank_monologtest: (onExecute): sc_include_library("Project", "monolog", "monologtest.php", true, true);
    This seems to work but I cannot use the objects and functions in the 'onExecute'-part of the blank_monologtest application.

    How can I use objects and their functions/members without copying the object definitions in the 'onExecute' section?
    I appreciate any help.

    Regards Stephan
    Last edited by StephanT; 11-12-2018, 07:34 AM.