<?php
/**
* Created by PhpStorm.
* User: adriano
* Date: 25/02/19
* Time: 18.33
*/
/**
* suppose to have the folloqing scenario
* all your classe are in
...myPackg/
??? ghzAutoloader.php
??? samples
??? defaultImplementation.php
??? myPckg
? ??? Core
? ? ??? classOne.php
? ??? Helpers
? ??? helperOne.php
??? psr4sample.php
*/
require_once "../ghzAutoloader.php";
/* OPTION 1 you can define one top-level namespace -> 'myPckg'
and namespace classes accordingly as in class helperOne
*/
/*$namespacesBasedirs=['myPckg'=>[__DIR__ . DIRECTORY_SEPARATOR . 'myPckg' . DIRECTORY_SEPARATOR]];
ghzAutoloader::Psr4Implementation($namespacesBasedirs,false,true);
$one=new \myPckg\Core\classOne();
$h=new \myPckg\Helpers\helperOne();*/
/* option2 you can define two top-level name spaces
myPckg and Helpers
and namespace classes accordingly as in class helperTwo
*/
$namespacesBasedirs=[
'myPckg'=>[__DIR__ . DIRECTORY_SEPARATOR . 'myPckg' . DIRECTORY_SEPARATOR],
'Helpers'=>[__DIR__ . DIRECTORY_SEPARATOR . 'myPckg' . DIRECTORY_SEPARATOR.'Helpers' . DIRECTORY_SEPARATOR],
];
ghzAutoloader::Psr4Implementation($namespacesBasedirs,false,true);
$one=new \myPckg\Core\classOne();
$h=new \myPckg\Helpers\helperOne();
$h2=new \Helpers\helperTwo();
|